Class: OpeningTree::Node
- Inherits:
-
Object
- Object
- OpeningTree::Node
- Defined in:
- lib/eco_classifier/opening_tree.rb
Overview
children -> maps move names to more nodes
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#opening ⇒ Object
Returns the value of attribute opening.
Instance Method Summary collapse
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
- #is_leaf? ⇒ Boolean
- #set_opening(opening) ⇒ Object
Constructor Details
#initialize ⇒ Node
Returns a new instance of Node.
13 14 15 |
# File 'lib/eco_classifier/opening_tree.rb', line 13 def initialize @children = {} end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
11 12 13 |
# File 'lib/eco_classifier/opening_tree.rb', line 11 def children @children end |
#opening ⇒ Object
Returns the value of attribute opening.
11 12 13 |
# File 'lib/eco_classifier/opening_tree.rb', line 11 def opening @opening end |
Instance Method Details
#inspect ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eco_classifier/opening_tree.rb', line 25 def inspect if @opening %( <Node @eco="#{@opening.eco}" @name="#{@opening.name}" @n_children=#{@children.size}> ).gsub(/\s+/, ' ') else %(<Node @n_children=#{@children.size}>) end end |
#is_leaf? ⇒ Boolean
21 22 23 |
# File 'lib/eco_classifier/opening_tree.rb', line 21 def is_leaf? @children.size == 0 end |
#set_opening(opening) ⇒ Object
17 18 19 |
# File 'lib/eco_classifier/opening_tree.rb', line 17 def set_opening(opening) @opening = opening end |