Class: SGF::Variation

Inherits:
Object
  • Object
show all
Defined in:
lib/sgf/variation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVariation



3
4
5
6
# File 'lib/sgf/variation.rb', line 3

def initialize
  @root = SGF::Node.new
  @size = 1
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



2
3
4
# File 'lib/sgf/variation.rb', line 2

def root
  @root
end

Instance Method Details

#append(node) ⇒ Object



8
9
10
11
# File 'lib/sgf/variation.rb', line 8

def append node
  @root.add_children node
  @size += 1
end

#sizeObject



13
14
15
# File 'lib/sgf/variation.rb', line 13

def size
  @size
end