class SportDb::CsvGoalParser

Public Class Methods

new( txt ) click to toggle source
# File lib/sportdb/structs/goal_parser_csv.rb, line 16
def initialize( txt )
  @txt = txt
end
parse( txt ) click to toggle source
# File lib/sportdb/structs/goal_parser_csv.rb, line 11
def self.parse( txt )
   new( txt ).parse
end
read( path ) click to toggle source
# File lib/sportdb/structs/goal_parser_csv.rb, line 6
def self.read( path )
   txt = File.open( path, 'r:utf-8' ) {|f| f.read }   ## note: make sure to use (assume) utf-8
   parse( txt )
end

Public Instance Methods

parse() click to toggle source
# File lib/sportdb/structs/goal_parser_csv.rb, line 20
def parse
  rows = parse_csv( @txt )
  recs = rows.map { |row| Sports::GoalEvent.build( row ) }
  ## pp recs[0]
  recs
end