Class: LibTAD::Astronomy::AstronomyDay

Inherits:
Object
  • Object
show all
Defined in:
lib/types/astronomy/astronomy_day.rb

Overview

Information about an astronomy object for a specific day.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dateString (readonly)

Date for the current information.

Returns:

  • (String)


7
8
9
# File 'lib/types/astronomy/astronomy_day.rb', line 7

def date
  @date
end

#daylengthString (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.

Returns:

  • (String)


13
14
15
# File 'lib/types/astronomy/astronomy_day.rb', line 13

def daylength
  @daylength
end

#eventsArray<AstronomyDayEvent> (readonly)

Lists all events during the day.

Returns:



21
22
23
# File 'lib/types/astronomy/astronomy_day.rb', line 21

def events
  @events
end

#moonphaseString (readonly)

Moon phase for the day. Only if requested.

Returns:

  • (String)


17
18
19
# File 'lib/types/astronomy/astronomy_day.rb', line 17

def moonphase
  @moonphase
end