Class: Bchess::PGN::PGNFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ PGNFile

Returns a new instance of PGNFile.



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

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

#filepathObject

Returns the value of attribute filepath.



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

def filepath
  @filepath
end

#gamesObject

Returns the value of attribute games.



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

def games
  @games
end

Instance Method Details

#load_gamesObject



10
11
12
13
# File 'lib/pgn/pgn_file.rb', line 10

def load_games
  file = File.open(filepath, 'rt')
  @content = file.read
end