Class: PGN::Parser

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

Overview

Parser is the public entry point for parsing PGN text into a list of game hashes. It delegates to the stdlib Racc + StringScanner parser PgnParser.

Instance Method Summary collapse

Instance Method Details

#parse(input) ⇒ Array<Hash>

Returns one Hash per game, with keys :tags, :result, :moves, :pgn, :comment.

Parameters:

  • input (String)

    the raw PGN text (already force-encoded by the caller, e.g. via PGN.parse).

Returns:

  • (Array<Hash>)

    one Hash per game, with keys :tags, :result, :moves, :pgn, :comment.



14
15
16
# File 'lib/pgn/parser.rb', line 14

def parse(input)
  PGN::PgnParser.new.parse(input)
end