Class: Astronoby::MoonPhase
- Inherits:
-
Object
- Object
- Astronoby::MoonPhase
- Defined in:
- lib/astronoby/moon_phase.rb
Constant Summary collapse
- NEW_MOON =
:new_moon
- FIRST_QUARTER =
:first_quarter
- FULL_MOON =
:full_moon
- LAST_QUARTER =
:last_quarter
Instance Attribute Summary collapse
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
-
.first_quarter(time) ⇒ Astronoby::MoonPhase
First quarter Moon phase.
-
.full_moon(time) ⇒ Astronoby::MoonPhase
Full Moon phase.
-
.last_quarter(time) ⇒ Astronoby::MoonPhase
Last quarter Moon phase.
-
.new_moon(time) ⇒ Astronoby::MoonPhase
New Moon phase.
Instance Method Summary collapse
-
#initialize(time:, phase:) ⇒ MoonPhase
constructor
A new instance of MoonPhase.
Constructor Details
#initialize(time:, phase:) ⇒ MoonPhase
Returns a new instance of MoonPhase.
38 39 40 41 |
# File 'lib/astronoby/moon_phase.rb', line 38 def initialize(time:, phase:) @time = time @phase = phase end |
Instance Attribute Details
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
10 11 12 |
# File 'lib/astronoby/moon_phase.rb', line 10 def phase @phase end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
10 11 12 |
# File 'lib/astronoby/moon_phase.rb', line 10 def time @time end |
Class Method Details
.first_quarter(time) ⇒ Astronoby::MoonPhase
Returns First quarter Moon phase.
20 21 22 |
# File 'lib/astronoby/moon_phase.rb', line 20 def self.first_quarter(time) new(time: time, phase: FIRST_QUARTER) end |
.full_moon(time) ⇒ Astronoby::MoonPhase
Returns Full Moon phase.
26 27 28 |
# File 'lib/astronoby/moon_phase.rb', line 26 def self.full_moon(time) new(time: time, phase: FULL_MOON) end |
.last_quarter(time) ⇒ Astronoby::MoonPhase
Returns Last quarter Moon phase.
32 33 34 |
# File 'lib/astronoby/moon_phase.rb', line 32 def self.last_quarter(time) new(time: time, phase: LAST_QUARTER) end |
.new_moon(time) ⇒ Astronoby::MoonPhase
Returns New Moon phase.
14 15 16 |
# File 'lib/astronoby/moon_phase.rb', line 14 def self.new_moon(time) new(time: time, phase: NEW_MOON) end |