Class: LibTAD::Astronomy::MoonPhase

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

Overview

Moon phase.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ MoonPhase

Returns a new instance of MoonPhase.



32
33
34
# File 'lib/types/astronomy/moonphase.rb', line 32

def initialize(id)
  @id = id
end

Instance Attribute Details

#idString (readonly)

Moonphase id.

Returns:

  • (String)


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

def id
  @id
end

Instance Method Details

#descriptionString

Moonphase description.

Returns:

  • (String)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/types/astronomy/moonphase.rb', line 11

def description
  case @id
  when 'newmoon'
    'New moon'
  when 'waxingcrescent'
    'Waxing crescent'
  when 'firstquarter'
    'Moon in first quarter'
  when 'waxinggibbous'
    'Waxing gibbous moon'
  when 'fullmoon'
    'Full moon'
  when 'waninggibbous'
    'Waning gibbous moon'
  when 'thirdquarter'
    'Moon in third quarter'
  when 'waningcrescent'
    'Waning crescent moon'
  end
end