Class: MlsStandings::Team

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(team_hash) ⇒ Team

Returns a new instance of Team.



6
7
8
9
# File 'lib/mls_standings/team.rb', line 6

def initialize(team_hash)
  team_hash.each_key{|k| self.send("#{k}=", team_hash[k])}
  @@all << self
end

Instance Attribute Details

#games_playedObject

Returns the value of attribute games_played.



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

def games_played
  @games_played
end

#lossesObject

Returns the value of attribute losses.



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

def losses
  @losses
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#tiesObject

Returns the value of attribute ties.



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

def ties
  @ties
end

#winsObject

Returns the value of attribute wins.



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

def wins
  @wins
end

Class Method Details

.allObject



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

def self.all
  @@all
end

.create_from_scrape(team) ⇒ Object



15
16
17
# File 'lib/mls_standings/team.rb', line 15

def self.create_from_scrape(team)
  self.new(team)
end

.eastern_confObject



19
20
21
# File 'lib/mls_standings/team.rb', line 19

def self.eastern_conf
  self.all[0..11]
end

.western_confObject



23
24
25
# File 'lib/mls_standings/team.rb', line 23

def self.western_conf
  self.all[12..23]
end