Class: Edoors::Door
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Iota
#name, #parent, #path, #spin, #viewer
Class Method Summary collapse
-
.json_create(o) ⇒ Object
creates a Door object from a JSON data.
Instance Method Summary collapse
-
#initialize(n, p) ⇒ Door
constructor
creates a Door object from the arguments.
-
#process_p(p) ⇒ Object
process the given particle then forward it to user code.
-
#process_sys_p(p) ⇒ Object
dead end, for now user defined Door do not have to deal with system Particle the Particle is released.
-
#release_p(p) ⇒ Object
release the given Particle.
-
#require_p(p_kls = Edoors::Particle) ⇒ Object
require a Particle of the given class.
-
#send_p(p, a = nil, d = nil) ⇒ Object
send the given Particle to the application Particle fifo.
-
#send_sys_p(p, a = nil, d = nil) ⇒ Object
send the given Particle to the system Particle fifo.
-
#to_json(*a) ⇒ Object
called by JSON#generate to serialize the Door object into JSON data.
Methods inherited from Iota
#hibernate!, #receive_p, #resume!, #start!, #stop!
Constructor Details
#initialize(n, p) ⇒ Door
creates a Door object from the arguments.
31 32 33 34 |
# File 'lib/edoors/door.rb', line 31 def initialize n, p super n, p @saved = nil end |
Class Method Details
Instance Method Details
#process_p(p) ⇒ Object
process the given particle then forward it to user code
91 92 93 94 95 96 |
# File 'lib/edoors/door.rb', line 91 def process_p p @viewer.receive_p p if @viewer @saved = p receive_p p _garbage if not @saved.nil? end |
#process_sys_p(p) ⇒ Object
dead end, for now user defined Door do not have to deal with system Particle the Particle is released
103 104 105 106 |
# File 'lib/edoors/door.rb', line 103 def process_sys_p p # nothing todo with it now @spin.release_p p end |
#release_p(p) ⇒ Object
release the given Particle
72 73 74 75 |
# File 'lib/edoors/door.rb', line 72 def release_p p @saved=nil if @saved==p # particle is released, all is good @spin.release_p p end |
#require_p(p_kls = Edoors::Particle) ⇒ Object
require a Particle of the given class
64 65 66 |
# File 'lib/edoors/door.rb', line 64 def require_p p_kls=Edoors::Particle @spin.require_p p_kls end |
#send_p(p, a = nil, d = nil) ⇒ Object
send the given Particle to the application Particle fifo
132 133 134 |
# File 'lib/edoors/door.rb', line 132 def send_p p, a=nil, d=nil _send p, false, a, d end |
#send_sys_p(p, a = nil, d = nil) ⇒ Object
send the given Particle to the system Particle fifo
144 145 146 |
# File 'lib/edoors/door.rb', line 144 def send_sys_p p, a=nil, d=nil _send p, true, a, d end |
#to_json(*a) ⇒ Object
called by JSON#generate to serialize the Door object into JSON data
40 41 42 43 44 45 |
# File 'lib/edoors/door.rb', line 40 def to_json *a { 'kls' => self.class.name, 'name' => @name }.merge(hibernate!).to_json *a end |