Class: NBA::RotationEntry
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- NBA::RotationEntry
- Defined in:
- lib/nba/rotation_entry.rb
Overview
Represents a player’s rotation entry in a game
Instance Attribute Summary collapse
-
#game_id ⇒ String
Returns the game ID.
-
#in_time_real ⇒ Integer
Returns the time the player checked in (in tenths of seconds from game start).
-
#out_time_real ⇒ Integer
Returns the time the player checked out (in tenths of seconds from game start).
-
#player_first ⇒ String
Returns the player’s first name.
-
#player_id ⇒ Integer
Returns the player ID.
-
#player_last ⇒ String
Returns the player’s last name.
-
#player_pts ⇒ Integer
Returns the points scored during this stint.
-
#pt_diff ⇒ Integer
Returns the point differential during this stint.
-
#team_city ⇒ String
Returns the team city.
-
#team_id ⇒ Integer
Returns the team ID.
-
#team_name ⇒ String
Returns the team name.
-
#usg_pct ⇒ Float
Returns the usage percentage during this stint.
Instance Method Summary collapse
-
#duration ⇒ Integer?
Returns the stint duration in tenths of seconds.
-
#game ⇒ Game?
Returns the game object.
-
#player ⇒ Player?
Returns the player object.
-
#player_name ⇒ String
Returns the player’s full name.
-
#team ⇒ Team?
Returns the team object.
Instance Attribute Details
#game_id ⇒ String
Returns the game ID
12 |
# File 'lib/nba/rotation_entry.rb', line 12 attribute :game_id, Shale::Type::String |
#in_time_real ⇒ Integer
Returns the time the player checked in (in tenths of seconds from game start)
68 |
# File 'lib/nba/rotation_entry.rb', line 68 attribute :in_time_real, Shale::Type::Integer |
#out_time_real ⇒ Integer
Returns the time the player checked out (in tenths of seconds from game start)
76 |
# File 'lib/nba/rotation_entry.rb', line 76 attribute :out_time_real, Shale::Type::Integer |
#player_first ⇒ String
Returns the player’s first name
52 |
# File 'lib/nba/rotation_entry.rb', line 52 attribute :player_first, Shale::Type::String |
#player_id ⇒ Integer
Returns the player ID
44 |
# File 'lib/nba/rotation_entry.rb', line 44 attribute :player_id, Shale::Type::Integer |
#player_last ⇒ String
Returns the player’s last name
60 |
# File 'lib/nba/rotation_entry.rb', line 60 attribute :player_last, Shale::Type::String |
#player_pts ⇒ Integer
Returns the points scored during this stint
84 |
# File 'lib/nba/rotation_entry.rb', line 84 attribute :player_pts, Shale::Type::Integer |
#pt_diff ⇒ Integer
Returns the point differential during this stint
92 |
# File 'lib/nba/rotation_entry.rb', line 92 attribute :pt_diff, Shale::Type::Integer |
#team_city ⇒ String
Returns the team city
28 |
# File 'lib/nba/rotation_entry.rb', line 28 attribute :team_city, Shale::Type::String |
#team_id ⇒ Integer
Returns the team ID
20 |
# File 'lib/nba/rotation_entry.rb', line 20 attribute :team_id, Shale::Type::Integer |
#team_name ⇒ String
Returns the team name
36 |
# File 'lib/nba/rotation_entry.rb', line 36 attribute :team_name, Shale::Type::String |
#usg_pct ⇒ Float
Returns the usage percentage during this stint
100 |
# File 'lib/nba/rotation_entry.rb', line 100 attribute :usg_pct, Shale::Type::Float |
Instance Method Details
#duration ⇒ Integer?
Returns the stint duration in tenths of seconds
148 149 150 151 152 |
# File 'lib/nba/rotation_entry.rb', line 148 def duration return unless in_time_real && out_time_real out_time_real - in_time_real end |
#game ⇒ Game?
Returns the game object
128 129 130 |
# File 'lib/nba/rotation_entry.rb', line 128 def game Games.find(game_id) end |
#player ⇒ Player?
Returns the player object
108 109 110 |
# File 'lib/nba/rotation_entry.rb', line 108 def player Players.find(player_id) end |
#player_name ⇒ String
Returns the player’s full name
138 139 140 |
# File 'lib/nba/rotation_entry.rb', line 138 def player_name "#{player_first} #{player_last}".strip end |
#team ⇒ Team?
Returns the team object
118 119 120 |
# File 'lib/nba/rotation_entry.rb', line 118 def team Teams.find(team_id) end |