Module: PGN
- Defined in:
- lib/pgn.rb,
lib/pgn/fen.rb,
lib/pgn/game.rb,
lib/pgn/move.rb,
lib/pgn/board.rb,
lib/pgn/lexer.rb,
lib/pgn/parser.rb,
lib/pgn/version.rb,
lib/pgn/position.rb,
lib/pgn/pgn_parser.rb,
lib/pgn/serializer.rb,
lib/pgn/move_calculator.rb
Defined Under Namespace
Classes: Board, FEN, Game, Lexer, Move, MoveCalculator, MoveText, Parser, PgnParser, Position, Serializer, UnconsumedInputError
Constant Summary collapse
- VERSION =
'1.2.1'.freeze
Class Method Summary collapse
-
.parse(pgn, encoding = Encoding::ISO_8859_1) ⇒ Array<PGN::Game>
A list of games.
Class Method Details
.parse(pgn, encoding = Encoding::ISO_8859_1) ⇒ Array<PGN::Game>
Note:
The PGN spec specifies Latin-1 as the encoding for PGN files, so this is default.
Returns a list of games.
22 23 24 25 26 27 28 |
# File 'lib/pgn.rb', line 22 def self.parse(pgn, encoding = Encoding::ISO_8859_1) pgn.force_encoding(encoding) if encoding PGN::Parser.new.parse(pgn).map do |game| PGN::Game.new(game[:moves], game[:tags], game[:result], game[:pgn], game[:comment]) end end |