Class: SgfTools::Node
- Inherits:
-
Object
- Object
- SgfTools::Node
- Defined in:
- lib/sgf_tools/parser.rb
Instance Attribute Summary collapse
-
#branches ⇒ Object
Returns the value of attribute branches.
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(prop, branches) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
Constructor Details
#initialize(prop, branches) ⇒ Node
Returns a new instance of Node.
16 17 18 19 |
# File 'lib/sgf_tools/parser.rb', line 16 def initialize(prop, branches) @properties = prop @branches = branches end |
Instance Attribute Details
#branches ⇒ Object
Returns the value of attribute branches.
14 15 16 |
# File 'lib/sgf_tools/parser.rb', line 14 def branches @branches end |
#properties ⇒ Object
Returns the value of attribute properties.
13 14 15 |
# File 'lib/sgf_tools/parser.rb', line 13 def properties @properties end |
Instance Method Details
#[](key) ⇒ Object
30 31 32 |
# File 'lib/sgf_tools/parser.rb', line 30 def [](key) @properties[key] end |
#inspect ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/sgf_tools/parser.rb', line 21 def inspect str = "" str << @properties.inspect if !@branches.nil? && @branches.size > 0 str << " (#{@branches.size} variation(s))" end str end |