module SportDb

add convenience shortcut helpers

Public Class Methods

parse_club_props( txt ) click to toggle source
# File lib/sportdb/readers.rb, line 27
def self.parse_club_props( txt )  Import::ClubPropsReader.parse( txt ); end
parse_clubs( txt ) click to toggle source
# File lib/sportdb/readers.rb, line 30
def self.parse_clubs( txt )   recs = Import::ClubReader.parse( txt );   Import.catalog.clubs.add( recs ); end
parse_conf( txt, season: nil ) click to toggle source
# File lib/sportdb/readers.rb, line 20
def self.parse_conf( txt, season: nil )  ConfReader.parse( txt, season: season ); end
parse_leagues( txt ) click to toggle source
# File lib/sportdb/readers.rb, line 29
def self.parse_leagues( txt ) recs = Import::LeagueReader.parse( txt ); Import.catalog.leagues.add( recs ); end
parse_match( txt, season: nil ) click to toggle source
# File lib/sportdb/readers.rb, line 24
def self.parse_match( txt, season: nil )  MatchReader.parse( txt, season: season ); end
read( path, season: nil ) click to toggle source
# File lib/sportdb/readers.rb, line 33
def self.read( path, season: nil )
  pack = if File.directory?( path )          ## if directory assume "unzipped" package
            DirPackage.new( path )
         elsif File.file?( path ) && File.extname( path ) == '.zip'   ## check if file is a .zip (archive) file
            ZipPackage.new( path )
         else                                ## no package; assume single (standalone) datafile
           nil
         end

  if pack
     pack.read( season: season )
  else
    if Package.conf?( path )      ## check if datafile matches conf(iguration) naming (e.g. .conf.txt)
      read_conf( path, season: season )
    elsif Package.club_props?( path )
      read_club_props( path )
    else                                ## assume "regular" match datafile
      read_match( path, season: season )
    end
  end
end
read_club_props( path ) click to toggle source
# File lib/sportdb/readers.rb, line 26
def self.read_club_props( path )  Import::ClubPropsReader.read( path ); end
read_conf( path, season: nil ) click to toggle source
# File lib/sportdb/readers.rb, line 19
def self.read_conf( path, season: nil )  ConfReader.read( path, season: season ); end
read_match( path, season: nil ) click to toggle source

todo/check: add alias read_matches - why? why not?

# File lib/sportdb/readers.rb, line 23
def self.read_match( path, season: nil )  MatchReader.read( path, season: season ); end