Class: LibTAD::Astronomy::AstronomyDay
- Inherits:
-
Object
- Object
- LibTAD::Astronomy::AstronomyDay
- Defined in:
- lib/types/astronomy/astronomy_day.rb
Overview
Information about an astronomy object for a specific day.
Instance Attribute Summary collapse
-
#date ⇒ String
readonly
Date for the current information.
-
#daylength ⇒ String
readonly
Length of this day (time between sunrise and sunset).
-
#events ⇒ Array<AstronomyDayEvent>
readonly
Lists all events during the day.
-
#moonphase ⇒ String
readonly
Moon phase for the day.
Instance Method Summary collapse
-
#initialize(hash) ⇒ AstronomyDay
constructor
A new instance of AstronomyDay.
Constructor Details
#initialize(hash) ⇒ AstronomyDay
Returns a new instance of AstronomyDay.
23 24 25 26 27 28 29 |
# File 'lib/types/astronomy/astronomy_day.rb', line 23 def initialize(hash) @date = hash.fetch('date', nil) @daylength = hash.fetch('daylength', nil) @moonphase = hash.fetch('moonphase', nil) @events = hash.fetch('events', nil) &.map { |e| AstronomyDayEvent.new(e) } end |
Instance Attribute Details
#date ⇒ String (readonly)
Date for the current information.
7 8 9 |
# File 'lib/types/astronomy/astronomy_day.rb', line 7 def date @date end |
#daylength ⇒ String (readonly)
Length of this day (time between sunrise and sunset). If the sun is not up on this day, 00:00:00 will reported. If the sun does not set on this day, the value will read 24:00:00. Attribute only applies for the sun object and if requested.
13 14 15 |
# File 'lib/types/astronomy/astronomy_day.rb', line 13 def daylength @daylength end |
#events ⇒ Array<AstronomyDayEvent> (readonly)
Lists all events during the day.
21 22 23 |
# File 'lib/types/astronomy/astronomy_day.rb', line 21 def events @events end |
#moonphase ⇒ String (readonly)
Moon phase for the day. Only if requested.
17 18 19 |
# File 'lib/types/astronomy/astronomy_day.rb', line 17 def moonphase @moonphase end |