diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-28 12:09:38 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-28 12:09:38 +0200 |
commit | 30410001827906e4420fb14eca0bcdb61722396e (patch) | |
tree | 2ca660d482960ec87c4ce18d32e52b15f7c59cfe /lib/edoors/board.rb | |
parent | 6f52112a9ceb514fdba7716aec6207d7823f6c75 (diff) | |
download | edoors-ruby-30410001827906e4420fb14eca0bcdb61722396e.zip edoors-ruby-30410001827906e4420fb14eca0bcdb61722396e.tar.gz |
Board: add #flush! and #keep!
Diffstat (limited to 'lib/edoors/board.rb')
-rw-r--r-- | lib/edoors/board.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/edoors/board.rb b/lib/edoors/board.rb index 27c5c85..5a5d089 100644 --- a/lib/edoors/board.rb +++ b/lib/edoors/board.rb @@ -82,6 +82,25 @@ module Edoors _garbage if not @saved.nil? end # + # stores back the given Particle + # + # @param [Particle] p the particle to be stored + # + # this can be used to prevent the overhead of sending the particle back to self + # + def keep! p + @postponed[p.link_value] = p + @saved = nil + end + # + # sends away all stored Particle + # + def flush! + while p=@postponed.shift + send_p p[1] + end + end + # end # end |