class EcoDataFileParser

Parses the scid.eco data file into openings

Constants

ROW_SCANNER

Attributes

openings[RW]

Public Class Methods

new(eco_file) click to toggle source
# File lib/eco_classifier/eco_data_file_parser.rb, line 8
def initialize(eco_file)
  @text = open(eco_file, 'r').read.strip
  @text = @text.gsub(/\n  /, ' ')
  @openings = []
end

Public Instance Methods

scan_into_openings() click to toggle source
# File lib/eco_classifier/eco_data_file_parser.rb, line 14
def scan_into_openings
  @text.split(/\n/).each do |row|
    match = row.match(ROW_SCANNER)
    next unless match
    @openings << Opening.new(match)
  end
  @openings
end