class NbaStats::Player
Attributes
assists_pg[RW]
blocks_pg[RW]
experience[RW]
fg_percentage[RW]
ft_percentage[RW]
height[RW]
minutes_pg[RW]
name[RW]
number[RW]
player_url[RW]
points_pg[RW]
position[RW]
rebounds_pg[RW]
steals_pg[RW]
team[RW]
three_percentage[RW]
Public Class Methods
all()
click to toggle source
# File lib/nba_stats/player.rb, line 34 def self.all @@all end
create_from_collection(players_array)
click to toggle source
# File lib/nba_stats/player.rb, line 13 def self.create_from_collection(players_array) players_array.each do |player| new_player = NbaStats::Player.new(player) end end
create_from_collection_with_team(players_array, team)
click to toggle source
# File lib/nba_stats/player.rb, line 19 def self.create_from_collection_with_team(players_array, team) players_array.each do |player| new_player = NbaStats::Player.new(player) new_player.team = team team.players << new_player end end
new(player_hash)
click to toggle source
# File lib/nba_stats/player.rb, line 6 def initialize(player_hash) player_hash.each do |key, value| self.send("#{key}=", value) end @@all << self end
player_names()
click to toggle source
# File lib/nba_stats/player.rb, line 38 def self.player_names @@all.collect {|player| player.name} end
Public Instance Methods
add_player_stats()
click to toggle source
# File lib/nba_stats/player.rb, line 27 def add_player_stats stats_hash = NbaStats::Scraper.get_player_stats(self) stats_hash.each do |key,value| self.send("#{key}=", value) end end