class NbaStats::Team

Attributes

conference[RW]
name[RW]
players[RW]
team_url[RW]

Public Class Methods

all() click to toggle source
# File lib/nba_stats/team.rb, line 26
def self.all
  @@all
end
create_from_collection(teams_array) click to toggle source
# File lib/nba_stats/team.rb, line 20
def self.create_from_collection(teams_array)
  teams_array.each do |team|
    new_team = NbaStats::Team.new(team)
  end
end
eastern_names() click to toggle source
# File lib/nba_stats/team.rb, line 39
def self.eastern_names
  east = @@all.select {|team| team.conference == "East"}
  east.collect {|team| team.name}.sort
end
new(team_hash) click to toggle source
# File lib/nba_stats/team.rb, line 7
def initialize(team_hash)
  team_hash.each do |key, value|
    self.send("#{key}=", value)
  end
  @players = []
  @@all << self unless @@all.include? self
end
team_names() click to toggle source
# File lib/nba_stats/team.rb, line 30
def self.team_names
  @@all.collect {|team| team.name }
end
western_names() click to toggle source
# File lib/nba_stats/team.rb, line 34
def self.western_names
  west = @@all.select {|team| team.conference == "West"}
  west.collect {|team| team.name}.sort
end

Public Instance Methods

add_players() click to toggle source
# File lib/nba_stats/team.rb, line 15
def add_players
  players_array = NbaStats::Scraper.get_roster(self)
  NbaStats::Player.create_from_collection_with_team(players_array, self)
end