Class: NBA::BoxScoreFourFactorsPlayerStat

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

Overview

Represents a player’s four factors box score statistics for a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentString

Returns any comment (e.g., “DNP - Rest”)

Examples:

stat.comment #=> "DNP - Rest"

Returns:

  • (String)

    the comment



71
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 71

attribute :comment, Shale::Type::String

#efg_pctFloat

Returns effective field goal percentage

Examples:

stat.efg_pct #=> 0.625

Returns:

  • (Float)

    the effective field goal percentage



87
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 87

attribute :efg_pct, Shale::Type::Float

#fta_rateFloat

Returns free throw attempt rate

Examples:

stat.fta_rate #=> 0.45

Returns:

  • (Float)

    the free throw attempt rate



95
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 95

attribute :fta_rate, Shale::Type::Float

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400350"

Returns:

  • (String)

    the game ID



15
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 15

attribute :game_id, Shale::Type::String

#minString

Returns minutes played

Examples:

stat.min #=> "32:45"

Returns:

  • (String)

    the minutes played



79
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 79

attribute :min, Shale::Type::String

#opp_efg_pctFloat

Returns opponent effective field goal percentage

Examples:

stat.opp_efg_pct #=> 0.485

Returns:

  • (Float)

    the opponent effective field goal percentage



119
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 119

attribute :opp_efg_pct, Shale::Type::Float

#opp_fta_rateFloat

Returns opponent free throw attempt rate

Examples:

stat.opp_fta_rate #=> 0.28

Returns:

  • (Float)

    the opponent free throw attempt rate



127
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 127

attribute :opp_fta_rate, Shale::Type::Float

#opp_oreb_pctFloat

Returns opponent offensive rebound percentage

Examples:

stat.opp_oreb_pct #=> 22.5

Returns:

  • (Float)

    the opponent offensive rebound percentage



143
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 143

attribute :opp_oreb_pct, Shale::Type::Float

#opp_tov_pctFloat

Returns opponent turnover percentage

Examples:

stat.opp_tov_pct #=> 15.6

Returns:

  • (Float)

    the opponent turnover percentage



135
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 135

attribute :opp_tov_pct, Shale::Type::Float

#oreb_pctFloat

Returns offensive rebound percentage

Examples:

stat.oreb_pct #=> 3.2

Returns:

  • (Float)

    the offensive rebound percentage



111
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 111

attribute :oreb_pct, Shale::Type::Float

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



47
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 47

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"

Returns:

  • (String)

    the player name



55
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 55

attribute :player_name, Shale::Type::String

#start_positionString

Returns the starting position

Examples:

stat.start_position #=> "G"

Returns:

  • (String)

    the starting position



63
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 63

attribute :start_position, Shale::Type::String

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



31
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 31

attribute :team_abbreviation, Shale::Type::String

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



39
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 39

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



23
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 23

attribute :team_id, Shale::Type::Integer

#tov_pctFloat

Returns turnover percentage

Examples:

stat.tov_pct #=> 12.3

Returns:

  • (Float)

    the turnover percentage



103
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 103

attribute :tov_pct, Shale::Type::Float

Instance Method Details

#gameGame?

Returns the game object for this box score

Examples:

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

Returns:

  • (Game, nil)

    the game object



181
182
183
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 181

def game
  Games.find(game_id)
end

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



151
152
153
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 151

def player
  Players.find(player_id)
end

#starter?Boolean

Returns whether the player started the game

Examples:

stat.starter? #=> true

Returns:

  • (Boolean)

    true if the player started



171
172
173
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 171

def starter?
  !start_position.nil? && !start_position.empty?
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



161
162
163
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 161

def team
  Teams.find(team_id)
end