Class: NBA::TeamOnOffPlayerStat

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

Overview

Represents team statistics when a specific player is on or off the court

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ast ⇒ Float?

Returns assists

Examples:

stat.ast #=> 27.5

Returns:

  • (Float, nil) —

    assists



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

attribute :ast, Shale::Type::Float

#ast_rank ⇒ Integer?

Returns assists rank

Examples:

stat.ast_rank #=> 4

Returns:

  • (Integer, nil) —

    assists rank



417
# File 'lib/nba/team_on_off_player_stat.rb', line 417

attribute :ast_rank, Shale::Type::Integer

#blk ⇒ Float?

Returns blocks

Examples:

stat.blk #=> 4.8

Returns:

  • (Float, nil) —

    blocks



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

attribute :blk, Shale::Type::Float

#blk_rank ⇒ Integer?

Returns blocks rank

Examples:

stat.blk_rank #=> 19

Returns:

  • (Integer, nil) —

    blocks rank



441
# File 'lib/nba/team_on_off_player_stat.rb', line 441

attribute :blk_rank, Shale::Type::Integer

#blka ⇒ Float?

Returns blocked attempts

Examples:

stat.blka #=> 4.2

Returns:

  • (Float, nil) —

    blocked attempts



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

attribute :blka, Shale::Type::Float

#blka_rank ⇒ Integer?

Returns blocked attempts rank

Examples:

stat.blka_rank #=> 22

Returns:

  • (Integer, nil) —

    blocked attempts rank



449
# File 'lib/nba/team_on_off_player_stat.rb', line 449

attribute :blka_rank, Shale::Type::Integer

#court_status ⇒ String?

Returns the court status (On or Off)

Examples:

stat.court_status #=> "Off"

Returns:

  • (String, nil) —

    the court status



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

attribute :court_status, Shale::Type::String

#dreb ⇒ Float?

Returns defensive rebounds

Examples:

stat.dreb #=> 34.8

Returns:

  • (Float, nil) —

    defensive rebounds



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

attribute :dreb, Shale::Type::Float

#dreb_rank ⇒ Integer?

Returns defensive rebounds rank

Examples:

stat.dreb_rank #=> 11

Returns:

  • (Integer, nil) —

    defensive rebounds rank



401
# File 'lib/nba/team_on_off_player_stat.rb', line 401

attribute :dreb_rank, Shale::Type::Integer

#fg3_pct ⇒ Float?

Returns three-point percentage

Examples:

stat.fg3_pct #=> 0.368

Returns:

  • (Float, nil) —

    three-point percentage



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

attribute :fg3_pct, Shale::Type::Float

#fg3_pct_rank ⇒ Integer?

Returns three-point percentage rank

Examples:

stat.fg3_pct_rank #=> 7

Returns:

  • (Integer, nil) —

    three-point percentage rank



361
# File 'lib/nba/team_on_off_player_stat.rb', line 361

attribute :fg3_pct_rank, Shale::Type::Integer

#fg3a ⇒ Float?

Returns three-pointers attempted

Examples:

stat.fg3a #=> 40.2

Returns:

  • (Float, nil) —

    three-pointers attempted



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

attribute :fg3a, Shale::Type::Float

#fg3a_rank ⇒ Integer?

Returns three-pointers attempted rank

Examples:

stat.fg3a_rank #=> 5

Returns:

  • (Integer, nil) —

    three-pointers attempted rank



353
# File 'lib/nba/team_on_off_player_stat.rb', line 353

attribute :fg3a_rank, Shale::Type::Integer

#fg3m ⇒ Float?

Returns three-pointers made

Examples:

stat.fg3m #=> 14.8

Returns:

  • (Float, nil) —

    three-pointers made



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

attribute :fg3m, Shale::Type::Float

#fg3m_rank ⇒ Integer?

Returns three-pointers made rank

Examples:

stat.fg3m_rank #=> 3

Returns:

  • (Integer, nil) —

    three-pointers made rank



345
# File 'lib/nba/team_on_off_player_stat.rb', line 345

attribute :fg3m_rank, Shale::Type::Integer

#fg_pct ⇒ Float?

Returns field goal percentage

Examples:

stat.fg_pct #=> 0.451

Returns:

  • (Float, nil) —

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fg_pct_rank ⇒ Integer?

Returns field goal percentage rank

Examples:

stat.fg_pct_rank #=> 8

Returns:

  • (Integer, nil) —

    field goal percentage rank



337
# File 'lib/nba/team_on_off_player_stat.rb', line 337

attribute :fg_pct_rank, Shale::Type::Integer

#fga ⇒ Float?

Returns field goals attempted

Examples:

stat.fga #=> 87.8

Returns:

  • (Float, nil) —

    field goals attempted



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

attribute :fga, Shale::Type::Float

#fga_rank ⇒ Integer?

Returns field goals attempted rank

Examples:

stat.fga_rank #=> 12

Returns:

  • (Integer, nil) —

    field goals attempted rank



329
# File 'lib/nba/team_on_off_player_stat.rb', line 329

attribute :fga_rank, Shale::Type::Integer

#fgm ⇒ Float?

Returns field goals made

Examples:

stat.fgm #=> 39.6

Returns:

  • (Float, nil) —

    field goals made



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

attribute :fgm, Shale::Type::Float

#fgm_rank ⇒ Integer?

Returns field goals made rank

Examples:

stat.fgm_rank #=> 10

Returns:

  • (Integer, nil) —

    field goals made rank



321
# File 'lib/nba/team_on_off_player_stat.rb', line 321

attribute :fgm_rank, Shale::Type::Integer

#ft_pct ⇒ Float?

Returns free throw percentage

Examples:

stat.ft_pct #=> 0.805

Returns:

  • (Float, nil) —

    free throw percentage



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

attribute :ft_pct, Shale::Type::Float

#ft_pct_rank ⇒ Integer?

Returns free throw percentage rank

Examples:

stat.ft_pct_rank #=> 9

Returns:

  • (Integer, nil) —

    free throw percentage rank



385
# File 'lib/nba/team_on_off_player_stat.rb', line 385

attribute :ft_pct_rank, Shale::Type::Integer

#fta ⇒ Float?

Returns free throws attempted

Examples:

stat.fta #=> 22.1

Returns:

  • (Float, nil) —

    free throws attempted



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

attribute :fta, Shale::Type::Float

#fta_rank ⇒ Integer?

Returns free throws attempted rank

Examples:

stat.fta_rank #=> 16

Returns:

  • (Integer, nil) —

    free throws attempted rank



377
# File 'lib/nba/team_on_off_player_stat.rb', line 377

attribute :fta_rank, Shale::Type::Integer

#ftm ⇒ Float?

Returns free throws made

Examples:

stat.ftm #=> 17.8

Returns:

  • (Float, nil) —

    free throws made



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

attribute :ftm, Shale::Type::Float

#ftm_rank ⇒ Integer?

Returns free throws made rank

Examples:

stat.ftm_rank #=> 14

Returns:

  • (Integer, nil) —

    free throws made rank



369
# File 'lib/nba/team_on_off_player_stat.rb', line 369

attribute :ftm_rank, Shale::Type::Integer

#gp ⇒ Integer?

Returns games played

Examples:

stat.gp #=> 82

Returns:

  • (Integer, nil) —

    games played



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

attribute :gp, Shale::Type::Integer

#gp_rank ⇒ Integer?

Returns games played rank

Examples:

stat.gp_rank #=> 1

Returns:

  • (Integer, nil) —

    games played rank



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

attribute :gp_rank, Shale::Type::Integer

#group_set ⇒ String?

Returns the group set name

Examples:

stat.group_set #=> "Off"

Returns:

  • (String, nil) —

    the group set



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

attribute :group_set, Shale::Type::String

#l ⇒ Integer?

Returns losses

Examples:

stat.l #=> 36

Returns:

  • (Integer, nil) —

    losses



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

attribute :l, Shale::Type::Integer

#l_rank ⇒ Integer?

Returns losses rank

Examples:

stat.l_rank #=> 8

Returns:

  • (Integer, nil) —

    losses rank



297
# File 'lib/nba/team_on_off_player_stat.rb', line 297

attribute :l_rank, Shale::Type::Integer

#min ⇒ Float?

Returns minutes

Examples:

stat.min #=> 240.0

Returns:

  • (Float, nil) —

    minutes



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

attribute :min, Shale::Type::Float

#min_rank ⇒ Integer?

Returns minutes rank

Examples:

stat.min_rank #=> 15

Returns:

  • (Integer, nil) —

    minutes rank



313
# File 'lib/nba/team_on_off_player_stat.rb', line 313

attribute :min_rank, Shale::Type::Integer

#oreb ⇒ Float?

Returns offensive rebounds

Examples:

stat.oreb #=> 9.1

Returns:

  • (Float, nil) —

    offensive rebounds



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

attribute :oreb, Shale::Type::Float

#oreb_rank ⇒ Integer?

Returns offensive rebounds rank

Examples:

stat.oreb_rank #=> 20

Returns:

  • (Integer, nil) —

    offensive rebounds rank



393
# File 'lib/nba/team_on_off_player_stat.rb', line 393

attribute :oreb_rank, Shale::Type::Integer

#pf ⇒ Float?

Returns personal fouls

Examples:

stat.pf #=> 20.1

Returns:

  • (Float, nil) —

    personal fouls



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

attribute :pf, Shale::Type::Float

#pf_rank ⇒ Integer?

Returns personal fouls rank

Examples:

stat.pf_rank #=> 25

Returns:

  • (Integer, nil) —

    personal fouls rank



457
# File 'lib/nba/team_on_off_player_stat.rb', line 457

attribute :pf_rank, Shale::Type::Integer

#pfd ⇒ Float?

Returns personal fouls drawn

Examples:

stat.pfd #=> 18.9

Returns:

  • (Float, nil) —

    personal fouls drawn



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

attribute :pfd, Shale::Type::Float

#pfd_rank ⇒ Integer?

Returns personal fouls drawn rank

Examples:

stat.pfd_rank #=> 17

Returns:

  • (Integer, nil) —

    personal fouls drawn rank



465
# File 'lib/nba/team_on_off_player_stat.rb', line 465

attribute :pfd_rank, Shale::Type::Integer

#plus_minus ⇒ Float?

Returns plus/minus

Examples:

stat.plus_minus #=> 2.5

Returns:

  • (Float, nil) —

    plus/minus



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

attribute :plus_minus, Shale::Type::Float

#plus_minus_rank ⇒ Integer?

Returns plus/minus rank

Examples:

stat.plus_minus_rank #=> 6

Returns:

  • (Integer, nil) —

    plus/minus rank



481
# File 'lib/nba/team_on_off_player_stat.rb', line 481

attribute :plus_minus_rank, Shale::Type::Integer

#pts ⇒ Float?

Returns points

Examples:

stat.pts #=> 111.8

Returns:

  • (Float, nil) —

    points



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

attribute :pts, Shale::Type::Float

#pts_rank ⇒ Integer?

Returns points rank

Examples:

stat.pts_rank #=> 2

Returns:

  • (Integer, nil) —

    points rank



473
# File 'lib/nba/team_on_off_player_stat.rb', line 473

attribute :pts_rank, Shale::Type::Integer

#reb ⇒ Float?

Returns total rebounds

Examples:

stat.reb #=> 43.9

Returns:

  • (Float, nil) —

    total rebounds



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

attribute :reb, Shale::Type::Float

#reb_rank ⇒ Integer?

Returns total rebounds rank

Examples:

stat.reb_rank #=> 13

Returns:

  • (Integer, nil) —

    total rebounds rank



409
# File 'lib/nba/team_on_off_player_stat.rb', line 409

attribute :reb_rank, Shale::Type::Integer

#stl ⇒ Float?

Returns steals

Examples:

stat.stl #=> 7.6

Returns:

  • (Float, nil) —

    steals



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

attribute :stl, Shale::Type::Float

#stl_rank ⇒ Integer?

Returns steals rank

Examples:

stat.stl_rank #=> 7

Returns:

  • (Integer, nil) —

    steals rank



433
# File 'lib/nba/team_on_off_player_stat.rb', line 433

attribute :stl_rank, Shale::Type::Integer

#team_abbreviation ⇒ String?

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String, nil) —

    the team abbreviation



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

attribute :team_abbreviation, Shale::Type::String

#team_id ⇒ Integer?

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer, nil) —

    the team ID



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

attribute :team_id, Shale::Type::Integer

#team_name ⇒ String?

Returns the team name

Examples:

stat.team_name #=> "Warriors"

Returns:

  • (String, nil) —

    the team name



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

attribute :team_name, Shale::Type::String

#tov ⇒ Float?

Returns turnovers

Examples:

stat.tov #=> 14.1

Returns:

  • (Float, nil) —

    turnovers



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

attribute :tov, Shale::Type::Float

#tov_rank ⇒ Integer?

Returns turnovers rank

Examples:

stat.tov_rank #=> 18

Returns:

  • (Integer, nil) —

    turnovers rank



425
# File 'lib/nba/team_on_off_player_stat.rb', line 425

attribute :tov_rank, Shale::Type::Integer

#vs_player_id ⇒ Integer?

Returns the opponent player ID

Examples:

stat.vs_player_id #=> 201566

Returns:

  • (Integer, nil) —

    the opponent player ID



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

attribute :vs_player_id, Shale::Type::Integer

#vs_player_name ⇒ String?

Returns the opponent player name

Examples:

stat.vs_player_name #=> "Russell Westbrook"

Returns:

  • (String, nil) —

    the opponent player name



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

attribute :vs_player_name, Shale::Type::String

#w ⇒ Integer?

Returns wins

Examples:

stat.w #=> 46

Returns:

  • (Integer, nil) —

    wins



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

attribute :w, Shale::Type::Integer

#w_pct ⇒ Float?

Returns win percentage

Examples:

stat.w_pct #=> 0.561

Returns:

  • (Float, nil) —

    win percentage



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

attribute :w_pct, Shale::Type::Float

#w_pct_rank ⇒ Integer?

Returns win percentage rank

Examples:

stat.w_pct_rank #=> 6

Returns:

  • (Integer, nil) —

    win percentage rank



305
# File 'lib/nba/team_on_off_player_stat.rb', line 305

attribute :w_pct_rank, Shale::Type::Integer

#w_rank ⇒ Integer?

Returns wins rank

Examples:

stat.w_rank #=> 5

Returns:

  • (Integer, nil) —

    wins rank



289
# File 'lib/nba/team_on_off_player_stat.rb', line 289

attribute :w_rank, Shale::Type::Integer

Instance Method Details

#off_court? ⇒ Boolean

Returns whether the player was off the court

Examples:

stat.off_court? #=> true

Returns:

  • (Boolean) —

    true if the player was off the court



519
520
521
# File 'lib/nba/team_on_off_player_stat.rb', line 519

def off_court?
  court_status.eql?("Off")
end

#on_court? ⇒ Boolean

Returns whether the player was on the court

Examples:

stat.on_court? #=> true

Returns:

  • (Boolean) —

    true if the player was on the court



509
510
511
# File 'lib/nba/team_on_off_player_stat.rb', line 509

def on_court?
  court_status.eql?("On")
end

#team ⇒ Team?

Returns the team object

Examples:

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

Returns:

  • (Team, nil) —

    the team object



489
490
491
# File 'lib/nba/team_on_off_player_stat.rb', line 489

def team
  Teams.find(team_id)
end

#vs_player ⇒ Player?

Returns the versus player object

Examples:

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

Returns:

  • (Player, nil) —

    the versus player object



499
500
501
# File 'lib/nba/team_on_off_player_stat.rb', line 499

def vs_player
  Players.find(vs_player_id)
end