Class: Worldfootball::LeagueConfig
- Inherits:
-
Object
- Object
- Worldfootball::LeagueConfig
- Defined in:
- lib/worldfootball/leagues.rb
Defined Under Namespace
Classes: LeagueItem
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add(recs) ⇒ Object
-
#initialize ⇒ LeagueConfig
constructor
A new instance of LeagueConfig.
- #keys ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ LeagueConfig
Returns a new instance of LeagueConfig.
5 6 7 |
# File 'lib/worldfootball/leagues.rb', line 5 def initialize @table = {} end |
Instance Method Details
#[](key) ⇒ Object
129 |
# File 'lib/worldfootball/leagues.rb', line 129 def [](key) @table[key.to_s.downcase]; end |
#add(recs) ⇒ Object
122 123 124 125 126 127 |
# File 'lib/worldfootball/leagues.rb', line 122 def add( recs ) recs.each do |rec| @table[ rec['key'] ] = LeagueItem.new( key: rec['key'], slug: rec['slug'] ) end end |
#keys ⇒ Object
130 |
# File 'lib/worldfootball/leagues.rb', line 130 def keys() @table.keys; end |
#size ⇒ Object
131 |
# File 'lib/worldfootball/leagues.rb', line 131 def size() @table.size; end |