diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-03 22:27:16 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-03 22:27:16 +0200 |
commit | 2ee48c4f18470e733f244c659221e243ff998416 (patch) | |
tree | 62949886912b3dc5eb9e000b211e7f45f17ed978 /lib/evendoors/door.rb | |
download | edoors-ruby-2ee48c4f18470e733f244c659221e243ff998416.zip edoors-ruby-2ee48c4f18470e733f244c659221e243ff998416.tar.gz |
initial commit
Diffstat (limited to 'lib/evendoors/door.rb')
-rw-r--r-- | lib/evendoors/door.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb new file mode 100644 index 0000000..9807d46 --- /dev/null +++ b/lib/evendoors/door.rb @@ -0,0 +1,54 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- + +# +module EvenDoors + # + class Door < Spot + # + def initialize n, p=nil + super n, p + @saved = nil + @parent.add_spot self if @parent + end + # + def require_p p_kls + p = EvenDoors::Twirl.require_p p_kls + p.src = self + p + end + # + def release_p p + @saved=nil if @saved==p # particle is released, all is good + EvenDoors::Twirl.release_p p + end + # + def process p + @viewer.receive p if @viewer + @saved = p + receive p + if not @saved.nil? + puts "application didn't give that particle back #{p}" if EvenDoors::Twirl.debug + puts "\t#{p.data EvenDoors::ERROR_FIELD}" if p.action==EvenDoors::ACT_ERROR + release_p @saved + @saved = nil + end + end + # + def send_p p + p.src = self + @saved=nil if @saved==p # particle is sent back the data, all is good + @parent.send_p p # daddy will know what to do + end + # + def send_sys_p p + p.src = self + @saved=nil if @saved==p # particle is sent back the data, all is good + @parent.send_sys_p p # daddy will know what to do + end + # + end + # +end +# +# EOF |