Class: TreeRepl::CmdNode

Inherits:
TreeNode show all
Defined in:
lib/treerepl/tree.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from TreeNode

#leaf, #name, #parent

Instance Method Summary collapse

Methods inherited from TreeNode

#children

Constructor Details

#initialize(obj, cmd, name) ⇒ CmdNode

Returns a new instance of CmdNode.



33
34
35
36
37
# File 'lib/treerepl/tree.rb', line 33

def initialize(obj,cmd,name)
  @obj = obj
  @cmd = cmd
  @name = name || cmd.to_s
end

Class Attribute Details

.classes2tree_nodesObject

Returns the value of attribute classes2tree_nodes.



29
30
31
# File 'lib/treerepl/tree.rb', line 29

def classes2tree_nodes
  @classes2tree_nodes
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



26
27
28
# File 'lib/treerepl/tree.rb', line 26

def cmd
  @cmd
end

Instance Method Details

#find_childrenObject



38
39
40
# File 'lib/treerepl/tree.rb', line 38

def find_children
  @obj.send(@cmd).map {|v| CmdNode.classes2tree_nodes[v.class].new v}
end