Module: LeagueInfoHelper

Included in:
Kernel
Defined in:
lib/football-timezones.rb

Instance Method Summary collapse

Instance Method Details

#_league_infoObject

load config on demand



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/football-timezones.rb', line 19

def _league_info   ## load config on demand
  @_leagues ||= begin
                  leagues = SportDb::LeagueConfig.new
                  ['leagues',
                  ].each do |name|
                    recs = read_csv( "#{SportDb::Module::Timezones.root}/config/#{name}.csv" )
                    leagues.add( recs )
                  end
                  leagues
                end
end

#find_league_info(league) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
# File 'lib/football-timezones.rb', line 31

def find_league_info( league )
   raise ArgumentError, "league key as string|symbol expected"  unless league.is_a?(String) || league.is_a?(Symbol)
   _league_info[ league ]
end