class NbaInfo::Team
Attributes
diff[RW]
gb[RW]
l_ten[RW]
name[RW]
opp_ppg[RW]
place[RW]
ppg[RW]
record[RW]
streak[RW]
win_pct[RW]
Public Class Methods
add_stats()
click to toggle source
# File lib/nba_info/team.rb, line 28 def self.add_stats self.create stats = NbaInfo::Scraper.scrape_stats @@nba[:east].each_with_index do |team, i| stats[:east][i].each do |key, val| team.send "#{key}=", val end end @@nba[:west].each_with_index do |team, i| stats[:west][i].each do |key, val| team.send "#{key}=", val end end @@nba end
create()
click to toggle source
# File lib/nba_info/team.rb, line 13 def self.create nba = NbaInfo::Scraper.scrape_team if @@nba[:east].empty? || @@nba[:west].empty? nba[:east].each do |team| t = self.new(team) @@nba[:east] << t end nba[:west].each do |team| t = self.new(team) @@nba[:west] << t end end @@nba end
new(team_hash)
click to toggle source
# File lib/nba_info/team.rb, line 7 def initialize(team_hash) team_hash.each do |key, val| self.send "#{key}=", val end end