Class: NBA::BoxScoreAdvancedPlayerStat

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ast_pctFloat

Returns assist percentage

Examples:

stat.ast_pct #=> 45.2

Returns:

  • (Float)

    the assist percentage



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

attribute :ast_pct, Shale::Type::Float

#ast_ratioFloat

Returns assist ratio

Examples:

stat.ast_ratio #=> 28.5

Returns:

  • (Float)

    the assist ratio



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

attribute :ast_ratio, Shale::Type::Float

#ast_tovFloat

Returns assist to turnover ratio

Examples:

stat.ast_tov #=> 2.75

Returns:

  • (Float)

    the assist to turnover ratio



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

attribute :ast_tov, Shale::Type::Float

#commentString

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

Examples:

stat.comment #=> "DNP - Rest"

Returns:

  • (String)

    the comment



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

attribute :comment, Shale::Type::String

#def_ratingFloat

Returns defensive rating

Examples:

stat.def_rating #=> 106.8

Returns:

  • (Float)

    the defensive rating



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

attribute :def_rating, Shale::Type::Float

#dreb_pctFloat

Returns defensive rebound percentage

Examples:

stat.dreb_pct #=> 18.6

Returns:

  • (Float)

    the defensive rebound percentage



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

attribute :dreb_pct, Shale::Type::Float

#e_def_ratingFloat

Returns estimated defensive rating

Examples:

stat.e_def_rating #=> 108.2

Returns:

  • (Float)

    the estimated defensive rating



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

attribute :e_def_rating, Shale::Type::Float

#e_net_ratingFloat

Returns estimated net rating

Examples:

stat.e_net_rating #=> 10.3

Returns:

  • (Float)

    the estimated net rating



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

attribute :e_net_rating, Shale::Type::Float

#e_off_ratingFloat

Returns estimated offensive rating

Examples:

stat.e_off_rating #=> 118.5

Returns:

  • (Float)

    the estimated offensive rating



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

attribute :e_off_rating, Shale::Type::Float

#e_paceFloat

Returns estimated pace

Examples:

stat.e_pace #=> 100.5

Returns:

  • (Float)

    the estimated pace



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

attribute :e_pace, Shale::Type::Float

#e_usg_pctFloat

Returns estimated usage percentage

Examples:

stat.e_usg_pct #=> 31.8

Returns:

  • (Float)

    the estimated usage percentage



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

attribute :e_usg_pct, Shale::Type::Float

#efg_pctFloat

Returns effective field goal percentage

Examples:

stat.efg_pct #=> 0.625

Returns:

  • (Float)

    the effective field goal percentage



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

attribute :efg_pct, Shale::Type::Float

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400350"

Returns:

  • (String)

    the game ID



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

attribute :game_id, Shale::Type::String

#minString

Returns minutes played

Examples:

stat.min #=> "32:45"

Returns:

  • (String)

    the minutes played



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

attribute :min, Shale::Type::String

#net_ratingFloat

Returns net rating

Examples:

stat.net_rating #=> 13.5

Returns:

  • (Float)

    the net rating



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

attribute :net_rating, Shale::Type::Float

#off_ratingFloat

Returns offensive rating

Examples:

stat.off_rating #=> 120.3

Returns:

  • (Float)

    the offensive rating



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

attribute :off_rating, Shale::Type::Float

#oreb_pctFloat

Returns offensive rebound percentage

Examples:

stat.oreb_pct #=> 3.2

Returns:

  • (Float)

    the offensive rebound percentage



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

attribute :oreb_pct, Shale::Type::Float

#paceFloat

Returns pace

Examples:

stat.pace #=> 102.3

Returns:

  • (Float)

    the pace



231
# File 'lib/nba/box_score_advanced_player_stat.rb', line 231

attribute :pace, Shale::Type::Float

#pace_per40Float

Returns pace per 40 minutes

Examples:

stat.pace_per40 #=> 101.8

Returns:

  • (Float)

    the pace per 40 minutes



239
# File 'lib/nba/box_score_advanced_player_stat.rb', line 239

attribute :pace_per40, Shale::Type::Float

#pieFloat

Returns player impact estimate

Examples:

stat.pie #=> 18.4

Returns:

  • (Float)

    the player impact estimate



255
# File 'lib/nba/box_score_advanced_player_stat.rb', line 255

attribute :pie, Shale::Type::Float

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



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

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"

Returns:

  • (String)

    the player name



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

attribute :player_name, Shale::Type::String

#possInteger

Returns possessions

Examples:

stat.poss #=> 65

Returns:

  • (Integer)

    the possessions



247
# File 'lib/nba/box_score_advanced_player_stat.rb', line 247

attribute :poss, Shale::Type::Integer

#reb_pctFloat

Returns total rebound percentage

Examples:

stat.reb_pct #=> 10.9

Returns:

  • (Float)

    the total rebound percentage



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

attribute :reb_pct, Shale::Type::Float

#start_positionString

Returns the starting position

Examples:

stat.start_position #=> "G"

Returns:

  • (String)

    the starting position



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

attribute :start_position, Shale::Type::String

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



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

attribute :team_abbreviation, Shale::Type::String

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



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

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

#tov_pctFloat

Returns turnover percentage

Examples:

stat.tov_pct #=> 12.3

Returns:

  • (Float)

    the turnover percentage



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

attribute :tov_pct, Shale::Type::Float

#ts_pctFloat

Returns true shooting percentage

Examples:

stat.ts_pct #=> 0.658

Returns:

  • (Float)

    the true shooting percentage



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

attribute :ts_pct, Shale::Type::Float

#usg_pctFloat

Returns usage percentage

Examples:

stat.usg_pct #=> 32.4

Returns:

  • (Float)

    the usage percentage



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

attribute :usg_pct, Shale::Type::Float

Instance Method Details

#gameGame?

Returns the game object for this box score

Examples:

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

Returns:

  • (Game, nil)

    the game object



293
294
295
# File 'lib/nba/box_score_advanced_player_stat.rb', line 293

def game
  Games.find(game_id)
end

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



263
264
265
# File 'lib/nba/box_score_advanced_player_stat.rb', line 263

def player
  Players.find(player_id)
end

#starter?Boolean

Returns whether the player started the game

Examples:

stat.starter? #=> true

Returns:

  • (Boolean)

    true if the player started



283
284
285
# File 'lib/nba/box_score_advanced_player_stat.rb', line 283

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

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



273
274
275
# File 'lib/nba/box_score_advanced_player_stat.rb', line 273

def team
  Teams.find(team_id)
end