Class: NBA::Shot
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- NBA::Shot
- Defined in:
- lib/nba/shot.rb
Overview
Represents a single shot attempt
Instance Attribute Summary collapse
-
#action_type ⇒ String
Returns the shot action type.
-
#game_event_id ⇒ Integer
Returns the game event ID.
-
#game_id ⇒ String
Returns the game ID.
-
#loc_x ⇒ Integer
Returns the X coordinate on the court.
-
#loc_y ⇒ Integer
Returns the Y coordinate on the court.
-
#minutes_remaining ⇒ Integer
Returns minutes remaining in period.
-
#period ⇒ Integer
Returns the period number.
-
#player_id ⇒ Integer
Returns the player ID.
-
#player_name ⇒ String
Returns the player name.
-
#seconds_remaining ⇒ Integer
Returns seconds remaining in period.
-
#shot_attempted_flag ⇒ Integer
Returns whether a shot was attempted.
-
#shot_distance ⇒ Integer
Returns the shot distance in feet.
-
#shot_made_flag ⇒ Integer
Returns whether the shot was made.
-
#shot_type ⇒ String
Returns the shot type (2PT or 3PT).
-
#shot_zone_area ⇒ String
Returns the shot zone area.
-
#shot_zone_basic ⇒ String
Returns the basic shot zone.
-
#shot_zone_range ⇒ String
Returns the shot zone range.
-
#team_id ⇒ Integer
Returns the team ID.
-
#team_name ⇒ String
Returns the team name.
Instance Method Summary collapse
-
#attempted? ⇒ Boolean
Returns whether a shot was attempted.
-
#game ⇒ Game?
Returns the game object for this shot.
-
#made? ⇒ Boolean
Returns whether the shot was made.
-
#missed? ⇒ Boolean
Returns whether the shot was missed.
-
#three_pointer? ⇒ Boolean
Returns whether this is a three-pointer.
Instance Attribute Details
#action_type ⇒ String
Returns the shot action type
84 |
# File 'lib/nba/shot.rb', line 84 attribute :action_type, Shale::Type::String |
#game_event_id ⇒ Integer
Returns the game event ID
20 |
# File 'lib/nba/shot.rb', line 20 attribute :game_event_id, Shale::Type::Integer |
#game_id ⇒ String
Returns the game ID
12 |
# File 'lib/nba/shot.rb', line 12 attribute :game_id, Shale::Type::String |
#loc_x ⇒ Integer
Returns the X coordinate on the court
132 |
# File 'lib/nba/shot.rb', line 132 attribute :loc_x, Shale::Type::Integer |
#loc_y ⇒ Integer
Returns the Y coordinate on the court
140 |
# File 'lib/nba/shot.rb', line 140 attribute :loc_y, Shale::Type::Integer |
#minutes_remaining ⇒ Integer
Returns minutes remaining in period
68 |
# File 'lib/nba/shot.rb', line 68 attribute :minutes_remaining, Shale::Type::Integer |
#period ⇒ Integer
Returns the period number
60 |
# File 'lib/nba/shot.rb', line 60 attribute :period, Shale::Type::Integer |
#player_id ⇒ Integer
Returns the player ID
28 |
# File 'lib/nba/shot.rb', line 28 attribute :player_id, Shale::Type::Integer |
#player_name ⇒ String
Returns the player name
36 |
# File 'lib/nba/shot.rb', line 36 attribute :player_name, Shale::Type::String |
#seconds_remaining ⇒ Integer
Returns seconds remaining in period
76 |
# File 'lib/nba/shot.rb', line 76 attribute :seconds_remaining, Shale::Type::Integer |
#shot_attempted_flag ⇒ Integer
Returns whether a shot was attempted
148 |
# File 'lib/nba/shot.rb', line 148 attribute :shot_attempted_flag, Shale::Type::Integer |
#shot_distance ⇒ Integer
Returns the shot distance in feet
124 |
# File 'lib/nba/shot.rb', line 124 attribute :shot_distance, Shale::Type::Integer |
#shot_made_flag ⇒ Integer
Returns whether the shot was made
156 |
# File 'lib/nba/shot.rb', line 156 attribute :shot_made_flag, Shale::Type::Integer |
#shot_type ⇒ String
Returns the shot type (2PT or 3PT)
92 |
# File 'lib/nba/shot.rb', line 92 attribute :shot_type, Shale::Type::String |
#shot_zone_area ⇒ String
Returns the shot zone area
108 |
# File 'lib/nba/shot.rb', line 108 attribute :shot_zone_area, Shale::Type::String |
#shot_zone_basic ⇒ String
Returns the basic shot zone
100 |
# File 'lib/nba/shot.rb', line 100 attribute :shot_zone_basic, Shale::Type::String |
#shot_zone_range ⇒ String
Returns the shot zone range
116 |
# File 'lib/nba/shot.rb', line 116 attribute :shot_zone_range, Shale::Type::String |
#team_id ⇒ Integer
Returns the team ID
44 |
# File 'lib/nba/shot.rb', line 44 attribute :team_id, Shale::Type::Integer |
#team_name ⇒ String
Returns the team name
52 |
# File 'lib/nba/shot.rb', line 52 attribute :team_name, Shale::Type::String |
Instance Method Details
#attempted? ⇒ Boolean
Returns whether a shot was attempted
164 165 166 |
# File 'lib/nba/shot.rb', line 164 def attempted? shot_attempted_flag.eql?(1) end |
#game ⇒ Game?
Returns the game object for this shot
204 205 206 |
# File 'lib/nba/shot.rb', line 204 def game Games.find(game_id) end |
#made? ⇒ Boolean
Returns whether the shot was made
174 175 176 |
# File 'lib/nba/shot.rb', line 174 def made? shot_made_flag.eql?(1) end |
#missed? ⇒ Boolean
Returns whether the shot was missed
184 185 186 |
# File 'lib/nba/shot.rb', line 184 def missed? shot_made_flag&.zero? end |
#three_pointer? ⇒ Boolean
Returns whether this is a three-pointer
194 195 196 |
# File 'lib/nba/shot.rb', line 194 def three_pointer? shot_type&.include?("3PT") end |