Class: NBA::BoxScorePlayerStat

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

Overview

Represents a player’s box score statistics for a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns assists

Examples:

stat.ast #=> 11

Returns:

  • (Integer)

    assists



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

attribute :ast, Shale::Type::Integer

#blkInteger

Returns blocks

Examples:

stat.blk #=> 1

Returns:

  • (Integer)

    blocks



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

attribute :blk, Shale::Type::Integer

#commentString

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

Examples:

stat.comment #=> "DNP - Rest"

Returns:

  • (String)

    the comment



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

attribute :comment, Shale::Type::String

#drebInteger

Returns defensive rebounds

Examples:

stat.dreb #=> 6

Returns:

  • (Integer)

    defensive rebounds



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

attribute :dreb, Shale::Type::Integer

#fg3_pctFloat

Returns three-point percentage

Examples:

stat.fg3_pct #=> 0.417

Returns:

  • (Float)

    three-point percentage



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

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns three-pointers attempted

Examples:

stat.fg3a #=> 12

Returns:

  • (Integer)

    three-pointers attempted



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

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns three-pointers made

Examples:

stat.fg3m #=> 5

Returns:

  • (Integer)

    three-pointers made



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

attribute :fg3m, Shale::Type::Integer

#fg_pctFloat

Returns field goal percentage

Examples:

stat.fg_pct #=> 0.500

Returns:

  • (Float)

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns field goals attempted

Examples:

stat.fga #=> 20

Returns:

  • (Integer)

    field goals attempted



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

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns field goals made

Examples:

stat.fgm #=> 10

Returns:

  • (Integer)

    field goals made



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

attribute :fgm, Shale::Type::Integer

#ft_pctFloat

Returns free throw percentage

Examples:

stat.ft_pct #=> 0.889

Returns:

  • (Float)

    free throw percentage



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

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns free throws attempted

Examples:

stat.fta #=> 9

Returns:

  • (Integer)

    free throws attempted



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

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns free throws made

Examples:

stat.ftm #=> 8

Returns:

  • (Integer)

    free throws made



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

attribute :ftm, Shale::Type::Integer

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400350"

Returns:

  • (String)

    the game ID



15
# File 'lib/nba/box_score_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_player_stat.rb', line 79

attribute :min, Shale::Type::String

#orebInteger

Returns offensive rebounds

Examples:

stat.oreb #=> 2

Returns:

  • (Integer)

    offensive rebounds



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

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns personal fouls

Examples:

stat.pf #=> 2

Returns:

  • (Integer)

    personal fouls



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

attribute :pf, Shale::Type::Integer

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



47
# File 'lib/nba/box_score_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_player_stat.rb', line 55

attribute :player_name, Shale::Type::String

#plus_minusInteger

Returns plus/minus

Examples:

stat.plus_minus #=> 12

Returns:

  • (Integer)

    plus/minus



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

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns points

Examples:

stat.pts #=> 33

Returns:

  • (Integer)

    points



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

attribute :pts, Shale::Type::Integer

#rebInteger

Returns total rebounds

Examples:

stat.reb #=> 8

Returns:

  • (Integer)

    total rebounds



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

attribute :reb, Shale::Type::Integer

#start_positionString

Returns the starting position

Examples:

stat.start_position #=> "G"

Returns:

  • (String)

    the starting position



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

attribute :start_position, Shale::Type::String

#stlInteger

Returns steals

Examples:

stat.stl #=> 3

Returns:

  • (Integer)

    steals



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

attribute :stl, Shale::Type::Integer

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



31
# File 'lib/nba/box_score_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_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_player_stat.rb', line 23

attribute :team_id, Shale::Type::Integer

#tovInteger

Returns turnovers

Examples:

stat.tov #=> 4

Returns:

  • (Integer)

    turnovers



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

attribute :tov, Shale::Type::Integer

Instance Method Details

#gameGame?

Returns the game object for this box score

Examples:

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

Returns:

  • (Game, nil)

    the game object



269
270
271
# File 'lib/nba/box_score_player_stat.rb', line 269

def game
  Games.find(game_id)
end

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



239
240
241
# File 'lib/nba/box_score_player_stat.rb', line 239

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



259
260
261
# File 'lib/nba/box_score_player_stat.rb', line 259

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



249
250
251
# File 'lib/nba/box_score_player_stat.rb', line 249

def team
  Teams.find(team_id)
end