| Class | Node |
| In: |
lib/node.rb
|
| Parent: | Object |
$LastChangedBy: polrop $ $Id: node.rb 171 2005-03-29 09:12:47Z polrop $
| data | [R] | |
| sub_nodes | [R] |
# File lib/node.rb, line 11 def initialize(data=nil, *sub_nodes) @data = data sub_nodes.each { |sub_node| check_sub_node_type(sub_node) } @sub_nodes = sub_nodes end
# File lib/node.rb, line 28 def <<(sub_node) check_sub_node_type(sub_node) @sub_nodes << sub_node end
# File lib/node.rb, line 23 def []=(sub_node_index, sub_node) check_sub_node_type(sub_node) @sub_nodes[sub_node_index] = sub_node end
# File lib/node.rb, line 43 def each_index(&block) @sub_nodes.each_with_index { |sub_node, index| block[index] } end
# File lib/node.rb, line 37 def each_node(&block) @sub_nodes.each_with_index { |sub_node, index| block[sub_node] } end
# File lib/node.rb, line 33 def each_pair(&block) @sub_nodes.each_with_index { |sub_node, i| block[i, sub_node] } end
# File lib/node.rb, line 62 def pre_depth_first(&block) block[self] @sub_nodes.each { |sub_node| sub_node.pre_depth_first(&block) } nil end