Class: Bchess::PGN::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/pgn/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed_game) ⇒ Game

Returns a new instance of Game.



6
7
8
9
# File 'lib/pgn/game.rb', line 6

def initialize(parsed_game)
  @header = Bchess::PGN::GameHeader.new(parsed_game.elements.first)
  @body = Bchess::PGN::GameBody.new(parsed_game.elements.last)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/pgn/game.rb', line 4

def body
  @body
end

#headerObject

Returns the value of attribute header.



4
5
6
# File 'lib/pgn/game.rb', line 4

def header
  @header
end

#movesObject

Returns the value of attribute moves.



4
5
6
# File 'lib/pgn/game.rb', line 4

def moves
  @moves
end

Instance Method Details

#convert_body_to_movesObject



11
12
13
14
15
# File 'lib/pgn/game.rb', line 11

def convert_body_to_moves
  body.extract_moves
  @moves = body.moves
  true
end