Class: NBA::PlayTypeStat

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

Overview

Represents synergy play type statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#efg_pctFloat

Returns effective field goal percentage

Examples:

stat.efg_pct #=> 0.538

Returns:

  • (Float)

    effective field goal percentage



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

attribute :efg_pct, Shale::Type::Float

#fg_pctFloat

Returns field goal percentage

Examples:

stat.fg_pct #=> 0.462

Returns:

  • (Float)

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns field goals attempted

Examples:

stat.fga #=> 130

Returns:

  • (Integer)

    field goals attempted



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

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns field goals made

Examples:

stat.fgm #=> 60

Returns:

  • (Integer)

    field goals made



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

attribute :fgm, Shale::Type::Integer

#ft_poss_pctFloat

Returns free throw possession percentage

Examples:

stat.ft_poss_pct #=> 0.12

Returns:

  • (Float)

    free throw possession percentage



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

attribute :ft_poss_pct, Shale::Type::Float

#gpInteger

Returns games played

Examples:

stat.gp #=> 74

Returns:

  • (Integer)

    games played



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

attribute :gp, Shale::Type::Integer

#percentileFloat

Returns the percentile ranking

Examples:

stat.percentile #=> 0.85

Returns:

  • (Float)

    percentile



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

attribute :percentile, Shale::Type::Float

#play_typeString

Returns the play type

Examples:

stat.play_type #=> "Isolation"

Returns:

  • (String)

    the play type



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

attribute :play_type, Shale::Type::String

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



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

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"

Returns:

  • (String)

    the player name



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

attribute :player_name, Shale::Type::String

#possInteger

Returns possessions

Examples:

stat.poss #=> 150

Returns:

  • (Integer)

    possessions



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

attribute :poss, Shale::Type::Integer

#poss_pctFloat

Returns possession percentage

Examples:

stat.poss_pct #=> 0.15

Returns:

  • (Float)

    possession percentage



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

attribute :poss_pct, Shale::Type::Float

#pppFloat

Returns points per possession

Examples:

stat.ppp #=> 1.2

Returns:

  • (Float)

    points per possession



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

attribute :ppp, Shale::Type::Float

#ptsInteger

Returns points

Examples:

stat.pts #=> 180

Returns:

  • (Integer)

    points



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

attribute :pts, Shale::Type::Integer

#pts_pctFloat

Returns points percentage

Examples:

stat.pts_pct #=> 0.20

Returns:

  • (Float)

    points percentage



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

attribute :pts_pct, Shale::Type::Float

#sf_poss_pctFloat

Returns shooting foul possession percentage

Examples:

stat.sf_poss_pct #=> 0.10

Returns:

  • (Float)

    shooting foul possession percentage



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

attribute :sf_poss_pct, Shale::Type::Float

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



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

attribute :team_abbreviation, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

#tov_poss_pctFloat

Returns turnover possession percentage

Examples:

stat.tov_poss_pct #=> 0.08

Returns:

  • (Float)

    turnover possession percentage



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

attribute :tov_poss_pct, Shale::Type::Float

#type_groupingString

Returns the type grouping (Offensive or Defensive)

Examples:

stat.type_grouping #=> "offensive"

Returns:

  • (String)

    the type grouping



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

attribute :type_grouping, Shale::Type::String

Instance Method Details

#defensive?Boolean

Returns whether this is defensive play type

Examples:

stat.defensive? #=> true

Returns:

  • (Boolean)

    true if defensive



202
203
204
# File 'lib/nba/play_type_stat.rb', line 202

def defensive?
  type_grouping.eql?("defensive")
end

#offensive?Boolean

Returns whether this is offensive play type

Examples:

stat.offensive? #=> true

Returns:

  • (Boolean)

    true if offensive



192
193
194
# File 'lib/nba/play_type_stat.rb', line 192

def offensive?
  type_grouping.eql?("offensive")
end

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



172
173
174
# File 'lib/nba/play_type_stat.rb', line 172

def player
  Players.find(player_id)
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



182
183
184
# File 'lib/nba/play_type_stat.rb', line 182

def team
  Teams.find(team_id)
end