Class: League
- Inherits:
-
Object
- Object
- League
- Defined in:
- lib/league.rb
Constant Summary collapse
- LeaguesHash =
{ :epl => { :full_name => "premierleague", :top_teams => 4, :middle_teams => 5, :bottom_teams => 3 }, :championship => { :full_name => "championship", :top_teams => 2, :middle_teams => 6, :bottom_teams => 3 }, :spl => { :full_name => "scottishpremierleague", :top_teams => 1, :middle_teams => 3, :bottom_teams => 2 }, :liga => { :full_name => "laligafootball", :top_teams => 3, :middle_teams => 6, :bottom_teams => 3 }, :ligue => { :full_name => "ligue1football", :top_teams => 3, :middle_teams => 4, :bottom_teams => 3 }, :seriea => { :full_name => "serieafootball", :top_teams => 3, :middle_teams => 5, :bottom_teams => 3 }, :bundesliga => { :full_name => "bundesligafootball", :top_teams => 4, :middle_teams => 6, :bottom_teams => 3 } }
- @@teams =
[]
Class Attribute Summary collapse
-
.bottom_teams ⇒ Object
Returns the value of attribute bottom_teams.
-
.league_full_name ⇒ Object
Returns the value of attribute league_full_name.
-
.league_symbol ⇒ Object
Returns the value of attribute league_symbol.
-
.longest_team_name_length ⇒ Object
Returns the value of attribute longest_team_name_length.
-
.middle_teams ⇒ Object
Returns the value of attribute middle_teams.
-
.top_teams ⇒ Object
Returns the value of attribute top_teams.
Class Method Summary collapse
- .get_longest_team_name_length ⇒ Object
- .set_bottom_teams ⇒ Object
- .set_league_full_name ⇒ Object
- .set_league_info(league_selection) ⇒ Object
- .set_middle_teams ⇒ Object
- .set_top_teams ⇒ Object
- .team_count ⇒ Object
- .teams ⇒ Object
Class Attribute Details
.bottom_teams ⇒ Object
Returns the value of attribute bottom_teams.
3 4 5 |
# File 'lib/league.rb', line 3 def bottom_teams @bottom_teams end |
.league_full_name ⇒ Object
Returns the value of attribute league_full_name.
3 4 5 |
# File 'lib/league.rb', line 3 def league_full_name @league_full_name end |
.league_symbol ⇒ Object
Returns the value of attribute league_symbol.
3 4 5 |
# File 'lib/league.rb', line 3 def league_symbol @league_symbol end |
.longest_team_name_length ⇒ Object
Returns the value of attribute longest_team_name_length.
3 4 5 |
# File 'lib/league.rb', line 3 def longest_team_name_length @longest_team_name_length end |
.middle_teams ⇒ Object
Returns the value of attribute middle_teams.
3 4 5 |
# File 'lib/league.rb', line 3 def middle_teams @middle_teams end |
.top_teams ⇒ Object
Returns the value of attribute top_teams.
3 4 5 |
# File 'lib/league.rb', line 3 def top_teams @top_teams end |
Class Method Details
.get_longest_team_name_length ⇒ Object
85 86 87 |
# File 'lib/league.rb', line 85 def self.get_longest_team_name_length self.longest_team_name_length ||= self.teams.sort_by {|t| t.name.length }.last.name.length end |
.set_bottom_teams ⇒ Object
81 82 83 |
# File 'lib/league.rb', line 81 def self.set_bottom_teams self.bottom_teams = League::LeaguesHash[league_symbol][:bottom_teams] end |
.set_league_full_name ⇒ Object
69 70 71 |
# File 'lib/league.rb', line 69 def self.set_league_full_name self.league_full_name = League::LeaguesHash[league_symbol][:full_name] end |
.set_league_info(league_selection) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/league.rb', line 61 def self.set_league_info(league_selection) self.league_symbol = league_selection self.set_league_full_name self.set_top_teams self.set_middle_teams self.set_bottom_teams end |
.set_middle_teams ⇒ Object
77 78 79 |
# File 'lib/league.rb', line 77 def self.set_middle_teams self.middle_teams = League::LeaguesHash[league_symbol][:middle_teams] end |
.set_top_teams ⇒ Object
73 74 75 |
# File 'lib/league.rb', line 73 def self.set_top_teams self.top_teams = League::LeaguesHash[league_symbol][:top_teams] end |
.team_count ⇒ Object
57 58 59 |
# File 'lib/league.rb', line 57 def self.team_count teams.length end |
.teams ⇒ Object
53 54 55 |
# File 'lib/league.rb', line 53 def self.teams @@teams end |