Class: NBA::TeamGameLogEntry

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

Overview

Represents a single team game log entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns assists

Examples:

log.ast #=> 28

Returns:

  • (Integer)

    assists



156
# File 'lib/nba/team_game_log_entry.rb', line 156

attribute :ast, Shale::Type::Integer

#blkInteger

Returns blocks

Examples:

log.blk #=> 5

Returns:

  • (Integer)

    blocks



172
# File 'lib/nba/team_game_log_entry.rb', line 172

attribute :blk, Shale::Type::Integer

#drebInteger

Returns defensive rebounds

Examples:

log.dreb #=> 35

Returns:

  • (Integer)

    defensive rebounds



140
# File 'lib/nba/team_game_log_entry.rb', line 140

attribute :dreb, Shale::Type::Integer

#fg3_pctFloat

Returns three-point percentage

Examples:

log.fg3_pct #=> 0.375

Returns:

  • (Float)

    three-point percentage



100
# File 'lib/nba/team_game_log_entry.rb', line 100

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns three-pointers attempted

Examples:

log.fg3a #=> 40

Returns:

  • (Integer)

    three-pointers attempted



92
# File 'lib/nba/team_game_log_entry.rb', line 92

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns three-pointers made

Examples:

log.fg3m #=> 15

Returns:

  • (Integer)

    three-pointers made



84
# File 'lib/nba/team_game_log_entry.rb', line 84

attribute :fg3m, Shale::Type::Integer

#fg_pctFloat

Returns field goal percentage

Examples:

log.fg_pct #=> 0.477

Returns:

  • (Float)

    field goal percentage



76
# File 'lib/nba/team_game_log_entry.rb', line 76

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns field goals attempted

Examples:

log.fga #=> 88

Returns:

  • (Integer)

    field goals attempted



68
# File 'lib/nba/team_game_log_entry.rb', line 68

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns field goals made

Examples:

log.fgm #=> 42

Returns:

  • (Integer)

    field goals made



60
# File 'lib/nba/team_game_log_entry.rb', line 60

attribute :fgm, Shale::Type::Integer

#ft_pctFloat

Returns free throw percentage

Examples:

log.ft_pct #=> 0.800

Returns:

  • (Float)

    free throw percentage



124
# File 'lib/nba/team_game_log_entry.rb', line 124

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns free throws attempted

Examples:

log.fta #=> 25

Returns:

  • (Integer)

    free throws attempted



116
# File 'lib/nba/team_game_log_entry.rb', line 116

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns free throws made

Examples:

log.ftm #=> 20

Returns:

  • (Integer)

    free throws made



108
# File 'lib/nba/team_game_log_entry.rb', line 108

attribute :ftm, Shale::Type::Integer

#game_dateString

Returns the game date

Examples:

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

Returns:

  • (String)

    the game date



28
# File 'lib/nba/team_game_log_entry.rb', line 28

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

log.game_id #=> "0022400001"

Returns:

  • (String)

    the game ID



20
# File 'lib/nba/team_game_log_entry.rb', line 20

attribute :game_id, Shale::Type::String

#matchupString

Returns the matchup description

Examples:

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

Returns:

  • (String)

    the matchup



36
# File 'lib/nba/team_game_log_entry.rb', line 36

attribute :matchup, Shale::Type::String

#minInteger

Returns the minutes played

Examples:

log.min #=> 240

Returns:

  • (Integer)

    the minutes played



52
# File 'lib/nba/team_game_log_entry.rb', line 52

attribute :min, Shale::Type::Integer

#orebInteger

Returns offensive rebounds

Examples:

log.oreb #=> 10

Returns:

  • (Integer)

    offensive rebounds



132
# File 'lib/nba/team_game_log_entry.rb', line 132

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns personal fouls

Examples:

log.pf #=> 18

Returns:

  • (Integer)

    personal fouls



188
# File 'lib/nba/team_game_log_entry.rb', line 188

attribute :pf, Shale::Type::Integer

#plus_minusInteger

Returns plus/minus

Examples:

log.plus_minus #=> 12

Returns:

  • (Integer)

    plus/minus



204
# File 'lib/nba/team_game_log_entry.rb', line 204

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns points

Examples:

log.pts #=> 119

Returns:

  • (Integer)

    points



196
# File 'lib/nba/team_game_log_entry.rb', line 196

attribute :pts, Shale::Type::Integer

#rebInteger

Returns total rebounds

Examples:

log.reb #=> 45

Returns:

  • (Integer)

    total rebounds



148
# File 'lib/nba/team_game_log_entry.rb', line 148

attribute :reb, Shale::Type::Integer

#stlInteger

Returns steals

Examples:

log.stl #=> 8

Returns:

  • (Integer)

    steals



164
# File 'lib/nba/team_game_log_entry.rb', line 164

attribute :stl, Shale::Type::Integer

#team_idInteger

Returns the team ID

Examples:

log.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



12
# File 'lib/nba/team_game_log_entry.rb', line 12

attribute :team_id, Shale::Type::Integer

#tovInteger

Returns turnovers

Examples:

log.tov #=> 12

Returns:

  • (Integer)

    turnovers



180
# File 'lib/nba/team_game_log_entry.rb', line 180

attribute :tov, Shale::Type::Integer

#wlString

Returns the win/loss result

Examples:

log.wl #=> "W"

Returns:

  • (String)

    the win/loss indicator



44
# File 'lib/nba/team_game_log_entry.rb', line 44

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



242
243
244
# File 'lib/nba/team_game_log_entry.rb', line 242

def game
  Games.find(game_id)
end

#loss?Boolean

Returns whether the game was a loss

Examples:

log.loss? #=> false

Returns:

  • (Boolean)

    whether the game was a loss



222
223
224
# File 'lib/nba/team_game_log_entry.rb', line 222

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

#teamTeam?

Returns the team object for this game log

Examples:

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

Returns:

  • (Team, nil)

    the team object



232
233
234
# File 'lib/nba/team_game_log_entry.rb', line 232

def team
  Teams.find(team_id)
end

#win?Boolean

Returns whether the game was a win

Examples:

log.win? #=> true

Returns:

  • (Boolean)

    whether the game was a win



212
213
214
# File 'lib/nba/team_game_log_entry.rb', line 212

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