Class: Ellington::Visualizer::Node

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/ellington/visualizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#baseObject (readonly)

Returns the value of attribute base.



9
10
11
# File 'lib/ellington/visualizer.rb', line 9

def base
  @base
end

#childrenObject (readonly)

Returns the value of attribute children.



9
10
11
# File 'lib/ellington/visualizer.rb', line 9

def children
  @children
end

#vizObject (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

#nameObject



18
19
20
# File 'lib/ellington/visualizer.rb', line 18

def name
  viz.id
end