Class: Edoors::Iota
- Inherits:
-
Object
- Object
- Edoors::Iota
- Defined in:
- lib/edoors/iota.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#spin ⇒ Object
readonly
Returns the value of attribute spin.
-
#viewer ⇒ Object
Returns the value of attribute viewer.
Instance Method Summary collapse
-
#hibernate! ⇒ Object
override this to save your object state on hibernate #.
-
#initialize(n, p) ⇒ Iota
constructor
creates a Iota object from the arguments.
-
#receive_p(p) ⇒ Object
has to be override, used by user side code.
-
#resume!(o) ⇒ Object
override this to restore your object state on resume.
-
#start! ⇒ Object
override this to initialize your object on system start.
-
#stop! ⇒ Object
override this to initialize your object on system stop.
Constructor Details
#initialize(n, p) ⇒ Iota
creates a Iota object from the arguments.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/edoors/iota.rb', line 36 def initialize n, p raise Edoors::Exception.new "Iota name #{n} is not valid" if n.include? Edoors::PATH_SEP @name = n # unique in it's room @parent = p # single direct parent @viewer = nil # particle going through that position will be sent there readonly @path = ( @parent ? @parent.path+Edoors::PATH_SEP : '') + @name @spin = ( @parent ? @parent.spin : self ) if @parent @parent.add_iota self @spin.add_to_world self if @spin.is_a? Edoors::Spin end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/edoors/iota.rb', line 49 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
50 51 52 |
# File 'lib/edoors/iota.rb', line 50 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
49 50 51 |
# File 'lib/edoors/iota.rb', line 49 def path @path end |
#spin ⇒ Object (readonly)
Returns the value of attribute spin.
49 50 51 |
# File 'lib/edoors/iota.rb', line 49 def spin @spin end |
#viewer ⇒ Object
Returns the value of attribute viewer.
50 51 52 |
# File 'lib/edoors/iota.rb', line 50 def viewer @viewer end |
Instance Method Details
#hibernate! ⇒ Object
override this to save your object state on hibernate
64 65 66 |
# File 'lib/edoors/iota.rb', line 64 def hibernate! {} end |
#receive_p(p) ⇒ Object
has to be override, used by user side code
77 78 79 |
# File 'lib/edoors/iota.rb', line 77 def receive_p p raise NoMethodError.new "#{self.path} receive_p(p) must be overridden" end |
#resume!(o) ⇒ Object
override this to restore your object state on resume
70 71 |
# File 'lib/edoors/iota.rb', line 70 def resume! o end |
#start! ⇒ Object
override this to initialize your object on system start
54 55 |
# File 'lib/edoors/iota.rb', line 54 def start! end |
#stop! ⇒ Object
override this to initialize your object on system stop
59 60 |
# File 'lib/edoors/iota.rb', line 59 def stop! end |