Class: NBA::GameLog

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

Overview

Represents a single game log entry for a player or team

API:

  • public

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns the assists

Examples:

log.ast #=> 8

Returns:

  • assists

API:

  • public



201
# File 'lib/nba/game_log.rb', line 201

attribute :ast, Shale::Type::Integer

#blkInteger

Returns the blocks

Examples:

log.blk #=> 0

Returns:

  • blocks

API:

  • public



217
# File 'lib/nba/game_log.rb', line 217

attribute :blk, Shale::Type::Integer

#drebInteger

Returns the defensive rebounds

Examples:

log.dreb #=> 5

Returns:

  • defensive rebounds

API:

  • public



185
# File 'lib/nba/game_log.rb', line 185

attribute :dreb, Shale::Type::Integer

#fg3_pctFloat

Returns the three-point percentage

Examples:

log.fg3_pct #=> 0.500

Returns:

  • three-point percentage

API:

  • public



145
# File 'lib/nba/game_log.rb', line 145

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns the three-pointers attempted

Examples:

log.fg3a #=> 10

Returns:

  • three-pointers attempted

API:

  • public



137
# File 'lib/nba/game_log.rb', line 137

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns the three-pointers made

Examples:

log.fg3m #=> 5

Returns:

  • three-pointers made

API:

  • public



129
# File 'lib/nba/game_log.rb', line 129

attribute :fg3m, Shale::Type::Integer

#fg_pctFloat

Returns the field goal percentage

Examples:

log.fg_pct #=> 0.500

Returns:

  • field goal percentage

API:

  • public



121
# File 'lib/nba/game_log.rb', line 121

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns the field goals attempted

Examples:

log.fga #=> 20

Returns:

  • field goals attempted

API:

  • public



113
# File 'lib/nba/game_log.rb', line 113

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns the field goals made

Examples:

log.fgm #=> 10

Returns:

  • field goals made

API:

  • public



105
# File 'lib/nba/game_log.rb', line 105

attribute :fgm, Shale::Type::Integer

#ft_pctFloat

Returns the free throw percentage

Examples:

log.ft_pct #=> 0.833

Returns:

  • free throw percentage

API:

  • public



169
# File 'lib/nba/game_log.rb', line 169

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns the free throws attempted

Examples:

log.fta #=> 6

Returns:

  • free throws attempted

API:

  • public



161
# File 'lib/nba/game_log.rb', line 161

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns the free throws made

Examples:

log.ftm #=> 5

Returns:

  • free throws made

API:

  • public



153
# File 'lib/nba/game_log.rb', line 153

attribute :ftm, Shale::Type::Integer

#game_dateString

Returns the game date

Examples:

log.game_date #=> "OCT 22, 2024"

Returns:

  • the game date

API:

  • public



73
# File 'lib/nba/game_log.rb', line 73

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

log.game_id #=> "0022400001"

Returns:

  • the game ID

API:

  • public



65
# File 'lib/nba/game_log.rb', line 65

attribute :game_id, Shale::Type::String

#matchupString

Returns the matchup description

Examples:

log.matchup #=> "GSW vs. LAL"

Returns:

  • the matchup

API:

  • public



81
# File 'lib/nba/game_log.rb', line 81

attribute :matchup, Shale::Type::String

#minInteger

Returns the minutes played

Examples:

log.min #=> 34

Returns:

  • the minutes played

API:

  • public



97
# File 'lib/nba/game_log.rb', line 97

attribute :min, Shale::Type::Integer

#orebInteger

Returns the offensive rebounds

Examples:

log.oreb #=> 1

Returns:

  • offensive rebounds

API:

  • public



177
# File 'lib/nba/game_log.rb', line 177

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns the personal fouls

Examples:

log.pf #=> 2

Returns:

  • personal fouls

API:

  • public



233
# File 'lib/nba/game_log.rb', line 233

attribute :pf, Shale::Type::Integer

#player_idInteger

Returns the player ID

Examples:

log.player_id #=> 201939

Returns:

  • the player ID

API:

  • public



25
# File 'lib/nba/game_log.rb', line 25

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

log.player_name #=> "Stephen Curry"

Returns:

  • the player name

API:

  • public



33
# File 'lib/nba/game_log.rb', line 33

attribute :player_name, Shale::Type::String

#plus_minusInteger

Returns the plus/minus

Examples:

log.plus_minus #=> 15

Returns:

  • plus/minus

API:

  • public



249
# File 'lib/nba/game_log.rb', line 249

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns the points scored

Examples:

log.pts #=> 30

Returns:

  • points

API:

  • public



241
# File 'lib/nba/game_log.rb', line 241

attribute :pts, Shale::Type::Integer

#rebInteger

Returns the total rebounds

Examples:

log.reb #=> 6

Returns:

  • total rebounds

API:

  • public



193
# File 'lib/nba/game_log.rb', line 193

attribute :reb, Shale::Type::Integer

#season_idString

Returns the season ID

Examples:

log.season_id #=> "22024"

Returns:

  • the season ID

API:

  • public



17
# File 'lib/nba/game_log.rb', line 17

attribute :season_id, Shale::Type::String

#stlInteger

Returns the steals

Examples:

log.stl #=> 2

Returns:

  • steals

API:

  • public



209
# File 'lib/nba/game_log.rb', line 209

attribute :stl, Shale::Type::Integer

#team_abbreviationString

Returns the team abbreviation

Examples:

log.team_abbreviation #=> "GSW"

Returns:

  • the team abbreviation

API:

  • public



49
# File 'lib/nba/game_log.rb', line 49

attribute :team_abbreviation, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

log.team_id #=> 1610612744

Returns:

  • the team ID

API:

  • public



41
# File 'lib/nba/game_log.rb', line 41

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

log.team_name #=> "Warriors"

Returns:

  • the team name

API:

  • public



57
# File 'lib/nba/game_log.rb', line 57

attribute :team_name, Shale::Type::String

#tovInteger

Returns the turnovers

Examples:

log.tov #=> 3

Returns:

  • turnovers

API:

  • public



225
# File 'lib/nba/game_log.rb', line 225

attribute :tov, Shale::Type::Integer

#wlString

Returns the win/loss indicator

Examples:

log.wl #=> "W"

Returns:

  • W for win, L for loss

API:

  • public



89
# File 'lib/nba/game_log.rb', line 89

attribute :wl, Shale::Type::String

Instance Method Details

#gameGame?

Returns the game object for this log entry

Examples:

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

Returns:

  • the game object

API:

  • public



273
# File 'lib/nba/game_log.rb', line 273

def game = Games.find(game_id)

#loss?Boolean

Returns whether the game was a loss

Examples:

log.loss? #=> false

Returns:

  • true if the game was a loss

API:

  • public



265
# File 'lib/nba/game_log.rb', line 265

def loss? = wl.eql?("L")

#playerPlayer?

Returns the player object for this log entry

Examples:

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

Returns:

  • the player object

API:

  • public



281
# File 'lib/nba/game_log.rb', line 281

def player = Players.find(player_id)

#win?Boolean

Returns whether the game was a win

Examples:

log.win? #=> true

Returns:

  • true if the game was a win

API:

  • public



257
# File 'lib/nba/game_log.rb', line 257

def win? = wl.eql?("W")