Class: Team

Inherits:
Object
  • Object
show all
Defined in:
lib/team.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/team.rb', line 2

def name
  @name
end

#playedObject

Returns the value of attribute played.



2
3
4
# File 'lib/team.rb', line 2

def played
  @played
end

#pointsObject

Returns the value of attribute points.



2
3
4
# File 'lib/team.rb', line 2

def points
  @points
end

#positionObject

Returns the value of attribute position.



2
3
4
# File 'lib/team.rb', line 2

def position
  @position
end

Instance Method Details

#bottom?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


12
13
14
# File 'lib/team.rb', line 12

def top?
  self.position.to_i <= League.top_teams
end