From 30410001827906e4420fb14eca0bcdb61722396e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 28 Jun 2012 12:09:38 +0200 Subject: Board: add #flush! and #keep! --- lib/edoors/board.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 -- cgit v1.1-2-g2b99