Class: MLB::PlayerStreak
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::PlayerStreak
- Defined in:
- lib/mlb/streaks.rb
Overview
Represents a player’s active streak (hitting streak, on-base streak, etc.)
Constant Summary collapse
- STREAK_HITTING =
"hittingStreak".freeze
- STREAK_ON_BASE =
"onBaseStreak".freeze
Instance Attribute Summary collapse
-
#current_streak ⇒ Integer
Returns the current streak length.
-
#current_streak_stat ⇒ String
Returns the stat during the streak.
-
#player_id ⇒ Integer
Returns the player ID.
-
#player_name ⇒ String
Returns the player name.
-
#streak_type ⇒ String
Returns the streak type.
-
#team ⇒ Team
Returns the player’s team.
Instance Method Summary collapse
-
#hitting_streak? ⇒ Boolean
Returns whether this is a hitting streak.
-
#on_base_streak? ⇒ Boolean
Returns whether this is an on-base streak.
Instance Attribute Details
#current_streak ⇒ Integer
Returns the current streak length
43 |
# File 'lib/mlb/streaks.rb', line 43 attribute :current_streak, Shale::Type::Integer |
#current_streak_stat ⇒ String
Returns the stat during the streak
51 |
# File 'lib/mlb/streaks.rb', line 51 attribute :current_streak_stat, Shale::Type::String |
#player_id ⇒ Integer
Returns the player ID
19 |
# File 'lib/mlb/streaks.rb', line 19 attribute :player_id, Shale::Type::Integer |
#player_name ⇒ String
Returns the player name
27 |
# File 'lib/mlb/streaks.rb', line 27 attribute :player_name, Shale::Type::String |
#streak_type ⇒ String
Returns the streak type
35 |
# File 'lib/mlb/streaks.rb', line 35 attribute :streak_type, Shale::Type::String |
Instance Method Details
#hitting_streak? ⇒ Boolean
Returns whether this is a hitting streak
67 |
# File 'lib/mlb/streaks.rb', line 67 def hitting_streak? = streak_type.eql?(STREAK_HITTING) |
#on_base_streak? ⇒ Boolean
Returns whether this is an on-base streak
75 |
# File 'lib/mlb/streaks.rb', line 75 def on_base_streak? = streak_type.eql?(STREAK_ON_BASE) |