summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-10 09:35:16 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-10 09:35:16 +0200
commit41f2adace41c562ea1ed486130c72eb4d1503044 (patch)
treefa6ec1ca039fca1cd729c59f2814adaacf598703 /lib
parent6886fa096d832b0682eafe631922694653384994 (diff)
downloadedoors-ruby-41f2adace41c562ea1ed486130c72eb4d1503044.zip
edoors-ruby-41f2adace41c562ea1ed486130c72eb4d1503044.tar.gz
Door,Board: factorise release of @saved particle
Diffstat (limited to 'lib')
-rw-r--r--lib/evendoors/board.rb7
-rw-r--r--lib/evendoors/door.rb14
2 files changed, 9 insertions, 12 deletions
diff --git a/lib/evendoors/board.rb b/lib/evendoors/board.rb
index 36ca332..ead1012 100644
--- a/lib/evendoors/board.rb
+++ b/lib/evendoors/board.rb
@@ -22,12 +22,7 @@ module EvenDoors
end
@saved = p
receive_p p
- if not @saved.nil?
- puts "#{path} didn't give that particle back #{p}" if EvenDoors::Spin.debug_errors
- puts "\t#{p.data EvenDoors::ERROR_FIELD}" if p.action==EvenDoors::ACT_ERROR
- release_p @saved
- @saved = nil
- end
+ garbage if not @saved.nil?
end
#
end
diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb
index 0fe3867..7cff0b9 100644
--- a/lib/evendoors/door.rb
+++ b/lib/evendoors/door.rb
@@ -23,16 +23,18 @@ module EvenDoors
EvenDoors::Spin.release_p p
end
#
+ def garbage
+ puts " * #{path} didn't give back #{p}" if EvenDoors::Spin.debug_errors
+ puts "\t#{@saved.data EvenDoors::ERROR_FIELD}" if @saved.action==EvenDoors::ACT_ERROR
+ release_p @saved
+ @saved = nil
+ end
+ #
def process_p p
@viewer.receive_p p if @viewer
@saved = p
receive_p p
- if not @saved.nil?
- puts "#{path} didn't give that particle back #{p}" if EvenDoors::Spin.debug_errors
- puts "\t#{p.data EvenDoors::ERROR_FIELD}" if p.action==EvenDoors::ACT_ERROR
- release_p @saved
- @saved = nil
- end
+ garbage if not @saved.nil?
end
#
def process_sys_p p