Class: LS4::Node
- Inherits:
-
Object
- Object
- LS4::Node
- Defined in:
- lib/ls4/logic/node.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nid ⇒ Object
readonly
Returns the value of attribute nid.
-
#rsids ⇒ Object
Returns the value of attribute rsids.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #from_msgpack(obj) ⇒ Object
-
#initialize(nid = 0, address = nil, name = nil, rsids = [], location = nil) ⇒ Node
constructor
A new instance of Node.
- #session ⇒ Object
- #to_msgpack(out = '') ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(nid = 0, address = nil, name = nil, rsids = [], location = nil) ⇒ Node
Returns a new instance of Node.
24 25 26 27 28 29 30 |
# File 'lib/ls4/logic/node.rb', line 24 def initialize(nid=0, address=nil, name=nil, rsids=[], location=nil) @nid = nid @address = address @name = name @rsids = rsids @location = location end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
33 34 35 |
# File 'lib/ls4/logic/node.rb', line 33 def address @address end |
#location ⇒ Object
Returns the value of attribute location.
36 37 38 |
# File 'lib/ls4/logic/node.rb', line 36 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
34 35 36 |
# File 'lib/ls4/logic/node.rb', line 34 def name @name end |
#nid ⇒ Object (readonly)
Returns the value of attribute nid.
32 33 34 |
# File 'lib/ls4/logic/node.rb', line 32 def nid @nid end |
#rsids ⇒ Object
Returns the value of attribute rsids.
35 36 37 |
# File 'lib/ls4/logic/node.rb', line 35 def rsids @rsids end |
Instance Method Details
#==(o) ⇒ Object
46 47 48 49 |
# File 'lib/ls4/logic/node.rb', line 46 def ==(o) # FIXME @nid == o.nid && @address == o.address end |
#from_msgpack(obj) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/ls4/logic/node.rb', line 55 def from_msgpack(obj) @nid = obj[0] @address = Address.load(obj[1]) @name = obj[2] @rsids = obj[3] @location = obj[4] self end |
#session ⇒ Object
38 39 40 |
# File 'lib/ls4/logic/node.rb', line 38 def session $net.get_session(*@address) end |
#to_msgpack(out = '') ⇒ Object
52 53 54 |
# File 'lib/ls4/logic/node.rb', line 52 def to_msgpack(out = '') [@nid, @address.dump, @name, @rsids, @location].to_msgpack(out) end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/ls4/logic/node.rb', line 42 def to_s "Node<#{@nid} #{@address} #{@name.dump} #{@rsids.inspect} #{@location.inspect}>" end |