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
- #add(node) ⇒ Object
- #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
#add(node) ⇒ Object
18 19 20 21 |
# File 'lib/ellington/visualizer.rb', line 18 def add(node) self << node node end |
#find(context) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/ellington/visualizer.rb', line 27 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
23 24 25 |
# File 'lib/ellington/visualizer.rb', line 23 def name viz.id end |