Class: Team
- Inherits:
-
Object
- Object
- Team
- Defined in:
- lib/team.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#played ⇒ Object
Returns the value of attribute played.
-
#points ⇒ Object
Returns the value of attribute points.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #bottom? ⇒ Boolean
-
#initialize(info) ⇒ Team
constructor
A new instance of Team.
- #middle? ⇒ Boolean
- #top? ⇒ Boolean
Constructor Details
#initialize(info) ⇒ Team
Returns a new instance of Team.
4 5 6 7 8 9 10 |
# File 'lib/team.rb', line 4 def initialize(info) @name = info[:name] @played = info[:played] @points = info[:points] @position = info[:position] League.teams << self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/team.rb', line 2 def name @name end |
#played ⇒ Object
Returns the value of attribute played.
2 3 4 |
# File 'lib/team.rb', line 2 def played @played end |
#points ⇒ Object
Returns the value of attribute points.
2 3 4 |
# File 'lib/team.rb', line 2 def points @points end |
#position ⇒ Object
Returns the value of attribute position.
2 3 4 |
# File 'lib/team.rb', line 2 def position @position end |
Instance Method Details
#bottom? ⇒ Boolean
20 21 22 |
# File 'lib/team.rb', line 20 def bottom? self.position.to_i >= League.team_count - (League.bottom_teams - 1) end |
#middle? ⇒ Boolean
16 17 18 |
# File 'lib/team.rb', line 16 def middle? League.middle_teams && self.position.to_i <= League.middle_teams end |
#top? ⇒ Boolean
12 13 14 |
# File 'lib/team.rb', line 12 def top? self.position.to_i <= League.top_teams end |