Class: NBA::TeamYearStat

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

Overview

Represents a team’s year-by-year statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astFloat

Returns assists per game

Examples:

stat.ast #=> 28.1

Returns:

  • (Float)

    assists



212
# File 'lib/nba/team_year_stat.rb', line 212

attribute :ast, Shale::Type::Float

#blkFloat

Returns blocks per game

Examples:

stat.blk #=> 5.2

Returns:

  • (Float)

    blocks



244
# File 'lib/nba/team_year_stat.rb', line 244

attribute :blk, Shale::Type::Float

#conf_rankInteger

Returns conference rank

Examples:

stat.conf_rank #=> 10

Returns:

  • (Integer)

    conference rank



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

attribute :conf_rank, Shale::Type::Integer

#div_rankInteger

Returns division rank

Examples:

stat.div_rank #=> 3

Returns:

  • (Integer)

    division rank



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

attribute :div_rank, Shale::Type::Integer

#drebFloat

Returns defensive rebounds per game

Examples:

stat.dreb #=> 33.8

Returns:

  • (Float)

    defensive rebounds



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

attribute :dreb, Shale::Type::Float

#fg3_pctFloat

Returns three-point percentage

Examples:

stat.fg3_pct #=> 0.368

Returns:

  • (Float)

    three-point percentage



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

attribute :fg3_pct, Shale::Type::Float

#fg3aFloat

Returns three-pointers attempted per game

Examples:

stat.fg3a #=> 40.2

Returns:

  • (Float)

    three-pointers attempted



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

attribute :fg3a, Shale::Type::Float

#fg3mFloat

Returns three-pointers made per game

Examples:

stat.fg3m #=> 14.8

Returns:

  • (Float)

    three-pointers made



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

attribute :fg3m, Shale::Type::Float

#fg_pctFloat

Returns field goal percentage

Examples:

stat.fg_pct #=> 0.472

Returns:

  • (Float)

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fgaFloat

Returns field goals attempted per game

Examples:

stat.fga #=> 91.5

Returns:

  • (Float)

    field goals attempted



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

attribute :fga, Shale::Type::Float

#fgmFloat

Returns field goals made per game

Examples:

stat.fgm #=> 43.2

Returns:

  • (Float)

    field goals made



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

attribute :fgm, Shale::Type::Float

#ft_pctFloat

Returns free throw percentage

Examples:

stat.ft_pct #=> 0.792

Returns:

  • (Float)

    free throw percentage



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

attribute :ft_pct, Shale::Type::Float

#ftaFloat

Returns free throws attempted per game

Examples:

stat.fta #=> 22.1

Returns:

  • (Float)

    free throws attempted



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

attribute :fta, Shale::Type::Float

#ftmFloat

Returns free throws made per game

Examples:

stat.ftm #=> 17.5

Returns:

  • (Float)

    free throws made



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

attribute :ftm, Shale::Type::Float

#gpInteger

Returns games played

Examples:

stat.gp #=> 82

Returns:

  • (Integer)

    games played



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

attribute :gp, Shale::Type::Integer

#lossesInteger

Returns losses

Examples:

stat.losses #=> 36

Returns:

  • (Integer)

    losses



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

attribute :losses, Shale::Type::Integer

#nba_finals_appearanceString

Returns NBA Finals appearance

Examples:

stat.nba_finals_appearance #=> "N/A"

Returns:

  • (String)

    Finals appearance



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

attribute :nba_finals_appearance, Shale::Type::String

#orebFloat

Returns offensive rebounds per game

Examples:

stat.oreb #=> 10.5

Returns:

  • (Float)

    offensive rebounds



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

attribute :oreb, Shale::Type::Float

#pfFloat

Returns personal fouls per game

Examples:

stat.pf #=> 19.5

Returns:

  • (Float)

    personal fouls



220
# File 'lib/nba/team_year_stat.rb', line 220

attribute :pf, Shale::Type::Float

#po_lossesInteger

Returns playoff losses

Examples:

stat.po_losses #=> 0

Returns:

  • (Integer)

    playoff losses



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

attribute :po_losses, Shale::Type::Integer

#po_winsInteger

Returns playoff wins

Examples:

stat.po_wins #=> 0

Returns:

  • (Integer)

    playoff wins



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

attribute :po_wins, Shale::Type::Integer

#ptsFloat

Returns points per game

Examples:

stat.pts #=> 118.7

Returns:

  • (Float)

    points



252
# File 'lib/nba/team_year_stat.rb', line 252

attribute :pts, Shale::Type::Float

#pts_rankInteger

Returns points rank

Examples:

stat.pts_rank #=> 5

Returns:

  • (Integer)

    points rank



260
# File 'lib/nba/team_year_stat.rb', line 260

attribute :pts_rank, Shale::Type::Integer

#rebFloat

Returns total rebounds per game

Examples:

stat.reb #=> 44.3

Returns:

  • (Float)

    total rebounds



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

attribute :reb, Shale::Type::Float

#stlFloat

Returns steals per game

Examples:

stat.stl #=> 7.8

Returns:

  • (Float)

    steals



228
# File 'lib/nba/team_year_stat.rb', line 228

attribute :stl, Shale::Type::Float

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



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

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

stat.team_name #=> "Warriors"

Returns:

  • (String)

    the team name



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

attribute :team_name, Shale::Type::String

#tovFloat

Returns turnovers per game

Examples:

stat.tov #=> 14.2

Returns:

  • (Float)

    turnovers



236
# File 'lib/nba/team_year_stat.rb', line 236

attribute :tov, Shale::Type::Float

#win_pctFloat

Returns win percentage

Examples:

stat.win_pct #=> 0.561

Returns:

  • (Float)

    win percentage



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

attribute :win_pct, Shale::Type::Float

#winsInteger

Returns wins

Examples:

stat.wins #=> 46

Returns:

  • (Integer)

    wins



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

attribute :wins, Shale::Type::Integer

#yearString

Returns the year

Examples:

stat.year #=> "2024-25"

Returns:

  • (String)

    the year



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

attribute :year, Shale::Type::String

Instance Method Details

#full_nameString

Returns the full team name

Examples:

stat.full_name #=> "Golden State Warriors"

Returns:

  • (String)

    the full name



278
279
280
# File 'lib/nba/team_year_stat.rb', line 278

def full_name
  "#{team_city} #{team_name}".strip
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



268
269
270
# File 'lib/nba/team_year_stat.rb', line 268

def team
  Teams.find(team_id)
end