Class: NBA::PassStat

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

Overview

Represents player tracking pass statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astFloat

Returns assists per game

Examples:

stat.ast #=> 2.1

Returns:

  • (Float)

    assists per game



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

attribute :ast, Shale::Type::Float

#fg2_pctFloat

Returns two-point percentage following pass

Examples:

stat.fg2_pct #=> 0.500

Returns:

  • (Float)

    two-point percentage



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

attribute :fg2_pct, Shale::Type::Float

#fg2aFloat

Returns two-pointers attempted following pass

Examples:

stat.fg2a #=> 3.0

Returns:

  • (Float)

    two-pointers attempted



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

attribute :fg2a, Shale::Type::Float

#fg2mFloat

Returns two-pointers made following pass

Examples:

stat.fg2m #=> 1.5

Returns:

  • (Float)

    two-pointers made



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

attribute :fg2m, Shale::Type::Float

#fg3_pctFloat

Returns three-point percentage following pass

Examples:

stat.fg3_pct #=> 0.476

Returns:

  • (Float)

    three-point percentage



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

attribute :fg3_pct, Shale::Type::Float

#fg3aFloat

Returns three-pointers attempted following pass

Examples:

stat.fg3a #=> 4.2

Returns:

  • (Float)

    three-pointers attempted



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

attribute :fg3a, Shale::Type::Float

#fg3mFloat

Returns three-pointers made following pass

Examples:

stat.fg3m #=> 2.0

Returns:

  • (Float)

    three-pointers made



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

attribute :fg3m, Shale::Type::Float

#fg_pctFloat

Returns field goal percentage following pass

Examples:

stat.fg_pct #=> 0.486

Returns:

  • (Float)

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fgaFloat

Returns field goals attempted following pass

Examples:

stat.fga #=> 7.2

Returns:

  • (Float)

    field goals attempted



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

attribute :fga, Shale::Type::Float

#fgmFloat

Returns field goals made following pass

Examples:

stat.fgm #=> 3.5

Returns:

  • (Float)

    field goals made



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

attribute :fgm, Shale::Type::Float

#frequencyFloat

Returns the frequency percentage

Examples:

stat.frequency #=> 0.25

Returns:

  • (Float)

    the frequency



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

attribute :frequency, Shale::Type::Float

#gInteger

Returns games

Examples:

stat.g #=> 74

Returns:

  • (Integer)

    games



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

attribute :g, Shale::Type::Integer

#gpInteger

Returns games played

Examples:

stat.gp #=> 74

Returns:

  • (Integer)

    games played



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

attribute :gp, Shale::Type::Integer

#passFloat

Returns passes per game

Examples:

stat.pass #=> 5.2

Returns:

  • (Float)

    passes per game



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

attribute :pass, Shale::Type::Float

#pass_teammate_player_idInteger

Returns the pass partner player ID

Examples:

stat.pass_teammate_player_id #=> 202691

Returns:

  • (Integer)

    the teammate player ID



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

attribute :pass_teammate_player_id, Shale::Type::Integer

#pass_toString

Returns the pass recipient or passer name

Examples:

stat.pass_to #=> "Klay Thompson"

Returns:

  • (String)

    the pass partner name



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

attribute :pass_to, Shale::Type::String

#pass_typeString

Returns the type of pass

Examples:

stat.pass_type #=> "Made"

Returns:

  • (String)

    the pass type



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

attribute :pass_type, Shale::Type::String

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



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

attribute :player_id, Shale::Type::Integer

#player_name_last_firstString

Returns the player name in “Last, First” format

Examples:

stat.player_name_last_first #=> "Curry, Stephen"

Returns:

  • (String)

    the player name



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

attribute :player_name_last_first, Shale::Type::String

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



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

attribute :team_abbreviation, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

Instance Method Details

#playerPlayer?

Returns the player object

Examples:

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

Returns:

  • (Player, nil)

    the player object



185
186
187
# File 'lib/nba/pass_stat.rb', line 185

def player
  Players.find(player_id)
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



205
206
207
# File 'lib/nba/pass_stat.rb', line 205

def team
  Teams.find(team_id)
end

#teammatePlayer?

Returns the teammate player object

Examples:

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

Returns:

  • (Player, nil)

    the teammate player object



195
196
197
# File 'lib/nba/pass_stat.rb', line 195

def teammate
  Players.find(pass_teammate_player_id)
end