Class: SgfTools::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/sgf_tools/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#branchesObject

Returns the value of attribute branches.



14
15
16
# File 'lib/sgf_tools/parser.rb', line 14

def branches
  @branches
end

#propertiesObject

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

#inspectObject



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