module PGN
Constants
- VERSION
Public Class Methods
parse(pgn, encoding = Encoding::ISO_8859_1)
click to toggle source
@param pgn [String] a pgn representation of one or more chess games @return [Array<PGN::Game>] a list of games
@note The PGN
spec specifies Latin-1 as the encoding for PGN
files, so
this is default.
@see www.chessclub.com/help/PGN-spec PGN
Specification
# File lib/pgn.rb, line 20 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]) end end