class LibTAD::Astronomy::AstronomyObject

Astronomical information - sunrise and sunset times.

Attributes

events[R]

@return [Array<AstronomyEvent>] Lists all sunrise/sunset events during the day.

name[R]

@return [String] Object name. Currently, the sun is the only supported astronomical object.

special[R]

@return [String] This element is only present if there are no astronomical events. In this case it will indicate if the sun is up or down the whole day.

Public Class Methods

new(hash) click to toggle source
# File lib/types/astronomy/astronomy_object.rb, line 18
def initialize(hash)
  @name = hash.fetch('name', nil)
  @events = hash.fetch('events', nil)
    &.map { |e| AstronomyEvent.new(e) }

  @special = hash.dig('special', 'type')
end