Class: Motoko::Node
- Inherits:
-
Object
- Object
- Motoko::Node
- Defined in:
- lib/motoko/node.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Choria
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
Instance Method Summary collapse
- #fact(name) ⇒ Object
-
#initialize(identity, facts) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(identity, facts) ⇒ Node
Returns a new instance of Node.
7 8 9 10 |
# File 'lib/motoko/node.rb', line 7 def initialize(identity, facts) @identity = identity @facts = facts end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
5 6 7 |
# File 'lib/motoko/node.rb', line 5 def identity @identity end |
Instance Method Details
#fact(name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/motoko/node.rb', line 12 def fact(name) result = @facts components = name.to_s.split('.') while (component = components.shift) case result when Hash result = result[component] when Array result = result[Integer(component)] when NilClass return nil end end result end |