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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns the assists

Examples:

log.ast #=> 8

Returns:

  • (Integer)

    assists



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

attribute :ast, Shale::Type::Integer

#blkInteger

Returns the blocks

Examples:

log.blk #=> 0

Returns:

  • (Integer)

    blocks



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

attribute :blk, Shale::Type::Integer

#drebInteger

Returns the defensive rebounds

Examples:

log.dreb #=> 5

Returns:

  • (Integer)

    defensive rebounds



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:

  • (Float)

    three-point percentage



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:

  • (Integer)

    three-pointers attempted



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:

  • (Integer)

    three-pointers made



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:

  • (Float)

    field goal percentage



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:

  • (Integer)

    field goals attempted



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:

  • (Integer)

    field goals made



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:

  • (Float)

    free throw percentage



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:

  • (Integer)

    free throws attempted



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:

  • (Integer)

    free throws made



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:

  • (String)

    the game date



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:

  • (String)

    the game ID



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:

  • (String)

    the matchup



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

attribute :matchup, Shale::Type::String

#minInteger

Returns the minutes played

Examples:

log.min #=> 34

Returns:

  • (Integer)

    the minutes played



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

attribute :min, Shale::Type::Integer

#orebInteger

Returns the offensive rebounds

Examples:

log.oreb #=> 1

Returns:

  • (Integer)

    offensive rebounds



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

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns the personal fouls

Examples:

log.pf #=> 2

Returns:

  • (Integer)

    personal fouls



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:

  • (Integer)

    the player ID



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:

  • (String)

    the player name



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:

  • (Integer)

    plus/minus



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:

  • (Integer)

    points



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

attribute :pts, Shale::Type::Integer

#rebInteger

Returns the total rebounds

Examples:

log.reb #=> 6

Returns:

  • (Integer)

    total rebounds



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:

  • (String)

    the season ID



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

attribute :season_id, Shale::Type::String

#stlInteger

Returns the steals

Examples:

log.stl #=> 2

Returns:

  • (Integer)

    steals



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:

  • (String)

    the team abbreviation



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:

  • (Integer)

    the team ID



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:

  • (String)

    the team name



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

attribute :team_name, Shale::Type::String

#tovInteger

Returns the turnovers

Examples:

log.tov #=> 3

Returns:

  • (Integer)

    turnovers



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:

  • (String)

    W for win, L for loss



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:

  • (Game, nil)

    the game object



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:

  • (Boolean)

    true if the game was a loss



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:

  • (Player, nil)

    the player object



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:

  • (Boolean)

    true if the game was a win



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

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