Class: Ellington::Visualizer::Node
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ellington::Visualizer::Node
- Defined in:
- lib/ellington/visualizer.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#viz ⇒ Object
readonly
Returns the value of attribute viz.
Instance Method Summary collapse
- #find(context) ⇒ Object
-
#initialize(base, viz) ⇒ Node
constructor
A new instance of Node.
- #name ⇒ Object
Constructor Details
#initialize(base, viz) ⇒ Node
Returns a new instance of Node.
11 12 13 14 15 16 |
# File 'lib/ellington/visualizer.rb', line 11 def initialize(base, viz) @base = base @viz = viz @children = [] super children end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9 10 11 |
# File 'lib/ellington/visualizer.rb', line 9 def base @base end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
9 10 11 |
# File 'lib/ellington/visualizer.rb', line 9 def children @children end |
#viz ⇒ Object (readonly)
Returns the value of attribute viz.
9 10 11 |
# File 'lib/ellington/visualizer.rb', line 9 def viz @viz end |
Instance Method Details
#find(context) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ellington/visualizer.rb', line 22 def find(context) if context.is_a?(String) to_a.select{ |node| node.name == context }.first else to_a.select{ |node| node.base == context }.first end end |
#name ⇒ Object
18 19 20 |
# File 'lib/ellington/visualizer.rb', line 18 def name viz.id end |