Class: NBA::BoxScoreUsagePlayerStat

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/nba/box_score_usage_player_stat.rb

Overview

Represents a player’s usage box score statistics for a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentString

Returns any comment (e.g., “DNP - Rest”)

Examples:

stat.comment #=> "DNP - Rest"


71
# File 'lib/nba/box_score_usage_player_stat.rb', line 71

attribute :comment, Shale::Type::String

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400565"


15
# File 'lib/nba/box_score_usage_player_stat.rb', line 15

attribute :game_id, Shale::Type::String

#minString

Returns minutes played

Examples:

stat.min #=> "35:24"


79
# File 'lib/nba/box_score_usage_player_stat.rb', line 79

attribute :min, Shale::Type::String

#pct_astFloat

Returns percentage of team assists

Examples:

stat.pct_ast #=> 0.32


167
# File 'lib/nba/box_score_usage_player_stat.rb', line 167

attribute :pct_ast, Shale::Type::Float

#pct_blkFloat

Returns percentage of team blocks

Examples:

stat.pct_blk #=> 0.20


191
# File 'lib/nba/box_score_usage_player_stat.rb', line 191

attribute :pct_blk, Shale::Type::Float

#pct_blkaFloat

Returns percentage of team blocked attempts

Examples:

stat.pct_blka #=> 0.12


199
# File 'lib/nba/box_score_usage_player_stat.rb', line 199

attribute :pct_blka, Shale::Type::Float

#pct_drebFloat

Returns percentage of team defensive rebounds

Examples:

stat.pct_dreb #=> 0.22


151
# File 'lib/nba/box_score_usage_player_stat.rb', line 151

attribute :pct_dreb, Shale::Type::Float

#pct_fg3aFloat

Returns percentage of team 3-pointers attempted

Examples:

stat.pct_fg3a #=> 0.38


119
# File 'lib/nba/box_score_usage_player_stat.rb', line 119

attribute :pct_fg3a, Shale::Type::Float

#pct_fg3mFloat

Returns percentage of team 3-pointers made

Examples:

stat.pct_fg3m #=> 0.35


111
# File 'lib/nba/box_score_usage_player_stat.rb', line 111

attribute :pct_fg3m, Shale::Type::Float

#pct_fgaFloat

Returns percentage of team field goals attempted

Examples:

stat.pct_fga #=> 0.27


103
# File 'lib/nba/box_score_usage_player_stat.rb', line 103

attribute :pct_fga, Shale::Type::Float

#pct_fgmFloat

Returns percentage of team field goals made

Examples:

stat.pct_fgm #=> 0.24


95
# File 'lib/nba/box_score_usage_player_stat.rb', line 95

attribute :pct_fgm, Shale::Type::Float

#pct_ftaFloat

Returns percentage of team free throws attempted

Examples:

stat.pct_fta #=> 0.30


135
# File 'lib/nba/box_score_usage_player_stat.rb', line 135

attribute :pct_fta, Shale::Type::Float

#pct_ftmFloat

Returns percentage of team free throws made

Examples:

stat.pct_ftm #=> 0.28


127
# File 'lib/nba/box_score_usage_player_stat.rb', line 127

attribute :pct_ftm, Shale::Type::Float

#pct_orebFloat

Returns percentage of team offensive rebounds

Examples:

stat.pct_oreb #=> 0.15


143
# File 'lib/nba/box_score_usage_player_stat.rb', line 143

attribute :pct_oreb, Shale::Type::Float

#pct_pfFloat

Returns percentage of team personal fouls

Examples:

stat.pct_pf #=> 0.16


207
# File 'lib/nba/box_score_usage_player_stat.rb', line 207

attribute :pct_pf, Shale::Type::Float

#pct_pfdFloat

Returns percentage of team personal fouls drawn

Examples:

stat.pct_pfd #=> 0.21


215
# File 'lib/nba/box_score_usage_player_stat.rb', line 215

attribute :pct_pfd, Shale::Type::Float

#pct_ptsFloat

Returns percentage of team points

Examples:

stat.pct_pts #=> 0.26


223
# File 'lib/nba/box_score_usage_player_stat.rb', line 223

attribute :pct_pts, Shale::Type::Float

#pct_rebFloat

Returns percentage of team total rebounds

Examples:

stat.pct_reb #=> 0.19


159
# File 'lib/nba/box_score_usage_player_stat.rb', line 159

attribute :pct_reb, Shale::Type::Float

#pct_stlFloat

Returns percentage of team steals

Examples:

stat.pct_stl #=> 0.25


183
# File 'lib/nba/box_score_usage_player_stat.rb', line 183

attribute :pct_stl, Shale::Type::Float

#pct_tovFloat

Returns percentage of team turnovers

Examples:

stat.pct_tov #=> 0.18


175
# File 'lib/nba/box_score_usage_player_stat.rb', line 175

attribute :pct_tov, Shale::Type::Float

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939


47
# File 'lib/nba/box_score_usage_player_stat.rb', line 47

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"


55
# File 'lib/nba/box_score_usage_player_stat.rb', line 55

attribute :player_name, Shale::Type::String

#start_positionString

Returns the starting position

Examples:

stat.start_position #=> "G"


63
# File 'lib/nba/box_score_usage_player_stat.rb', line 63

attribute :start_position, Shale::Type::String

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"


31
# File 'lib/nba/box_score_usage_player_stat.rb', line 31

attribute :team_abbreviation, Shale::Type::String

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"


39
# File 'lib/nba/box_score_usage_player_stat.rb', line 39

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744


23
# File 'lib/nba/box_score_usage_player_stat.rb', line 23

attribute :team_id, Shale::Type::Integer

#usg_pctFloat

Returns usage percentage

Examples:

stat.usg_pct #=> 0.285


87
# File 'lib/nba/box_score_usage_player_stat.rb', line 87

attribute :usg_pct, Shale::Type::Float

Instance Method Details

#gameGame?

Returns the game object for this box score

Examples:

stat.game #=> #<NBA::Game>


261
262
263
# File 'lib/nba/box_score_usage_player_stat.rb', line 261

def game
  Games.find(game_id)
end

#playerPlayer?

Returns the player object

Examples:

stat.player #=> #<NBA::Player>


231
232
233
# File 'lib/nba/box_score_usage_player_stat.rb', line 231

def player
  Players.find(player_id)
end

#starter?Boolean

Returns whether the player started the game

Examples:

stat.starter? #=> true


251
252
253
# File 'lib/nba/box_score_usage_player_stat.rb', line 251

def starter?
  !start_position.nil? && !start_position.empty?
end

#teamTeam?

Returns the team object

Examples:

stat.team #=> #<NBA::Team>


241
242
243
# File 'lib/nba/box_score_usage_player_stat.rb', line 241

def team
  Teams.find(team_id)
end