Class: MLB::GameDateTime

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/game_data.rb

Overview

Represents game date/time information

Constant Summary collapse

DAY =

Day game indicator value

"day".freeze
NIGHT =

Night game indicator value

"night".freeze
AM =

AM indicator value

"AM".freeze
PM =

PM indicator value

"PM".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#am_pmString

Returns AM or PM indicator

Examples:

datetime.am_pm #=> "PM"

Returns:

  • (String)

    AM or PM



47
# File 'lib/mlb/game_data.rb', line 47

attribute :am_pm, Shale::Type::String

#date_timeString

Returns the game date and time

Examples:

datetime.date_time #=> "2024-10-01T23:08:00Z"

Returns:

  • (String)

    the game date and time



15
# File 'lib/mlb/game_data.rb', line 15

attribute :date_time, Shale::Type::String

#day_nightString

Returns day or night game indicator

Examples:

datetime.day_night #=> "night"

Returns:

  • (String)

    day or night



31
# File 'lib/mlb/game_data.rb', line 31

attribute :day_night, Shale::Type::String

#original_dateString

Returns the original scheduled date

Examples:

datetime.original_date #=> "2024-10-01"

Returns:

  • (String)

    the original date



23
# File 'lib/mlb/game_data.rb', line 23

attribute :original_date, Shale::Type::String

#timeString

Returns the game time

Examples:

datetime.time #=> "7:08"

Returns:

  • (String)

    the time



39
# File 'lib/mlb/game_data.rb', line 39

attribute :time, Shale::Type::String

Instance Method Details

#am?Boolean

Returns whether this game starts in the morning (AM)

Examples:

datetime.am? #=> false

Returns:

  • (Boolean)

    true if the game starts in the morning



80
# File 'lib/mlb/game_data.rb', line 80

def am? = am_pm.eql?(AM)

#day?Boolean

Returns whether this is a day game

Examples:

datetime.day? #=> false

Returns:

  • (Boolean)

    true if the game is a day game



64
# File 'lib/mlb/game_data.rb', line 64

def day? = day_night.eql?(DAY)

#night?Boolean

Returns whether this is a night game

Examples:

datetime.night? #=> true

Returns:

  • (Boolean)

    true if the game is a night game



72
# File 'lib/mlb/game_data.rb', line 72

def night? = day_night.eql?(NIGHT)

#pm?Boolean

Returns whether this game starts in the afternoon/evening (PM)

Examples:

datetime.pm? #=> true

Returns:

  • (Boolean)

    true if the game starts in the afternoon/evening



88
# File 'lib/mlb/game_data.rb', line 88

def pm? = am_pm.eql?(PM)