Class: MLB::ScheduledGame
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::ScheduledGame
- Defined in:
- lib/mlb/scheduled_game.rb
Overview
Represents a scheduled game from the MLB Stats API
Constant Summary collapse
- DAY =
Day game indicator value
"day".freeze
- NIGHT =
Night game indicator value
"night".freeze
- DOUBLE_HEADER_VALUES =
Doubleheader indicator values that indicate a doubleheader
%w[Y S].freeze
- GAME_TYPE_REGULAR =
Game type: Regular Season
"R".freeze
- GAME_TYPE_SPRING =
Game type: Spring Training
"S".freeze
- GAME_TYPE_EXHIBITION =
Game type: Exhibition
"E".freeze
- GAME_TYPE_ALL_STAR =
Game type: All-Star Game
"A".freeze
- POSTSEASON_GAME_TYPES =
Game type codes that indicate postseason games
%w[F D L W].freeze
Instance Attribute Summary collapse
-
#day_night ⇒ String
Returns whether the game is a day or night game.
-
#double_header ⇒ String
Returns the doubleheader indicator.
-
#game_date ⇒ String
Returns the game date and time.
-
#game_number ⇒ Integer
Returns the game number (for doubleheaders).
-
#game_pk ⇒ Integer
Returns the unique game identifier.
-
#game_type ⇒ String
Returns the game type code.
-
#games_in_series ⇒ Integer
Returns the number of games in the series.
-
#is_tie ⇒ Boolean
(also: #tie?)
Returns whether the game ended in a tie.
-
#link ⇒ String
Returns the API link for the game feed.
-
#official_date ⇒ Date
Returns the official game date.
-
#scheduled_innings ⇒ Integer
Returns the number of scheduled innings.
-
#season ⇒ String
Returns the season year.
-
#series_description ⇒ String
Returns the series description.
-
#series_game_number ⇒ Integer
Returns the game number within the series.
-
#status ⇒ GameStatus
Returns the game status.
-
#teams ⇒ ScheduledGameTeams
Returns the teams playing.
-
#venue ⇒ Venue
Returns the game venue.
Instance Method Summary collapse
-
#all_star? ⇒ Boolean
Returns whether this is an All-Star game.
-
#day? ⇒ Boolean
Returns whether this is a day game.
-
#double_header? ⇒ Boolean
Returns whether this game is part of a doubleheader.
-
#exhibition? ⇒ Boolean
Returns whether this is an exhibition game.
-
#night? ⇒ Boolean
Returns whether this is a night game.
-
#postseason? ⇒ Boolean
Returns whether this is a postseason game.
-
#regular_season? ⇒ Boolean
Returns whether this is a regular season game.
-
#spring_training? ⇒ Boolean
Returns whether this is a spring training game.
Instance Attribute Details
#day_night ⇒ String
Returns whether the game is a day or night game
176 |
# File 'lib/mlb/scheduled_game.rb', line 176 attribute :day_night, Shale::Type::String |
#double_header ⇒ String
Returns the doubleheader indicator
168 |
# File 'lib/mlb/scheduled_game.rb', line 168 attribute :double_header, Shale::Type::String |
#game_date ⇒ String
Returns the game date and time
112 |
# File 'lib/mlb/scheduled_game.rb', line 112 attribute :game_date, Shale::Type::String |
#game_number ⇒ Integer
Returns the game number (for doubleheaders)
160 |
# File 'lib/mlb/scheduled_game.rb', line 160 attribute :game_number, Shale::Type::Integer |
#game_pk ⇒ Integer
Returns the unique game identifier
80 |
# File 'lib/mlb/scheduled_game.rb', line 80 attribute :game_pk, Shale::Type::Integer |
#game_type ⇒ String
Returns the game type code
96 |
# File 'lib/mlb/scheduled_game.rb', line 96 attribute :game_type, Shale::Type::String |
#games_in_series ⇒ Integer
Returns the number of games in the series
200 |
# File 'lib/mlb/scheduled_game.rb', line 200 attribute :games_in_series, Shale::Type::Integer |
#is_tie ⇒ Boolean Also known as: tie?
Returns whether the game ended in a tie
152 |
# File 'lib/mlb/scheduled_game.rb', line 152 attribute :is_tie, Shale::Type::Boolean |
#link ⇒ String
Returns the API link for the game feed
88 |
# File 'lib/mlb/scheduled_game.rb', line 88 attribute :link, Shale::Type::String |
#official_date ⇒ Date
Returns the official game date
120 |
# File 'lib/mlb/scheduled_game.rb', line 120 attribute :official_date, Shale::Type::Date |
#scheduled_innings ⇒ Integer
Returns the number of scheduled innings
184 |
# File 'lib/mlb/scheduled_game.rb', line 184 attribute :scheduled_innings, Shale::Type::Integer |
#season ⇒ String
Returns the season year
104 |
# File 'lib/mlb/scheduled_game.rb', line 104 attribute :season, Shale::Type::String |
#series_description ⇒ String
Returns the series description
192 |
# File 'lib/mlb/scheduled_game.rb', line 192 attribute :series_description, Shale::Type::String |
#series_game_number ⇒ Integer
Returns the game number within the series
208 |
# File 'lib/mlb/scheduled_game.rb', line 208 attribute :series_game_number, Shale::Type::Integer |
#status ⇒ GameStatus
Returns the game status
128 |
# File 'lib/mlb/scheduled_game.rb', line 128 attribute :status, GameStatus |
#teams ⇒ ScheduledGameTeams
Returns the teams playing
136 |
# File 'lib/mlb/scheduled_game.rb', line 136 attribute :teams, ScheduledGameTeams |
Instance Method Details
#all_star? ⇒ Boolean
Returns whether this is an All-Star game
290 |
# File 'lib/mlb/scheduled_game.rb', line 290 def all_star? = game_type.eql?(GAME_TYPE_ALL_STAR) |
#day? ⇒ Boolean
Returns whether this is a day game
241 |
# File 'lib/mlb/scheduled_game.rb', line 241 def day? = day_night.eql?(DAY) |
#double_header? ⇒ Boolean
Returns whether this game is part of a doubleheader
mutant:disable - .to_s is for type safety; include?(nil) returns false anyway
258 |
# File 'lib/mlb/scheduled_game.rb', line 258 def double_header? = DOUBLE_HEADER_VALUES.include?(double_header.to_s) |
#exhibition? ⇒ Boolean
Returns whether this is an exhibition game
282 |
# File 'lib/mlb/scheduled_game.rb', line 282 def exhibition? = game_type.eql?(GAME_TYPE_EXHIBITION) |
#night? ⇒ Boolean
Returns whether this is a night game
249 |
# File 'lib/mlb/scheduled_game.rb', line 249 def night? = day_night.eql?(NIGHT) |
#postseason? ⇒ Boolean
Returns whether this is a postseason game
mutant:disable - .to_s is for type safety; include?(nil) returns false anyway
299 |
# File 'lib/mlb/scheduled_game.rb', line 299 def postseason? = POSTSEASON_GAME_TYPES.include?(game_type.to_s) |
#regular_season? ⇒ Boolean
Returns whether this is a regular season game
266 |
# File 'lib/mlb/scheduled_game.rb', line 266 def regular_season? = game_type.eql?(GAME_TYPE_REGULAR) |
#spring_training? ⇒ Boolean
Returns whether this is a spring training game
274 |
# File 'lib/mlb/scheduled_game.rb', line 274 def spring_training? = game_type.eql?(GAME_TYPE_SPRING) |