class SportDb::Package

Public Instance Methods

read( *names, season: nil ) click to toggle source
# File lib/sportdb/readers/package.rb, line 47
def read( *names, season: nil )
  if names.empty?   ##  read all datafiles
    read_leagues()
    read_clubs()
    read_club_props()
    ## note:  skip conf(iguration)s for now!!!!!!!
    ## read_conf( season: season )
    read_match( season: season )
  else
    names.each do |name|
      entry = @pack.find( name )
      ## fix/todo: add read_leagues, read_clubs too!!!
      if match_conf?( name )      ## check if datafile matches conf(iguration) naming (e.g. .conf.txt)
        SportDb.parse_conf( entry.read, season: season )
      elsif match_club_props?( name )
        SportDb.parse_club_props( entry.read )
      else   ## assume "regular" match datafile or check pattern and report error on fail - why? why not?
        SportDb.parse_match( entry.read, season: season )
      end
    end
  end
end
read_club_props() click to toggle source
# File lib/sportdb/readers/package.rb, line 15
def read_club_props
  each_club_props { |entry| SportDb.parse_club_props( entry.read ) }
end
read_clubs() click to toggle source
# File lib/sportdb/readers/package.rb, line 11
def read_clubs
  each_clubs { |entry| SportDb.parse_clubs( entry.read ) }
end
read_conf( *names, season: nil ) click to toggle source
# File lib/sportdb/readers/package.rb, line 20
def read_conf( *names, season: nil )
  if names.empty?   ## no (entry) names passed in; read in all
    each_conf do |entry|
      SportDb.parse_conf( entry.read, season: season )
    end
  else
    names.each do |name|
      entry = @pack.find( name )
      SportDb.parse_conf( entry.read, season: season )
    end
  end
end
read_leagues() click to toggle source

note: add readers here; for full class def see the sourcein sportdb-formats!!!

# File lib/sportdb/readers/package.rb, line 7
def read_leagues
  each_leagues { |entry| SportDb.parse_leagues( entry.read ) }
end
read_match( *names, season: nil ) click to toggle source
# File lib/sportdb/readers/package.rb, line 33
def read_match( *names, season: nil )
  if names.empty?   ## no (entry) names passed in; read in all
    each_match do |entry|
      SportDb.parse_match( entry.read, season: season )
    end
  else
    names.each do |name|
      entry = @pack.find( name )
      SportDb.parse_match( entry.read, season: season )
    end
  end
end