Class: MoonCalc
- Inherits:
-
Object
- Object
- MoonCalc
- Defined in:
- lib/moon_calc.rb
Overview
Lunar/Moon phases ruby class
Code is based upon Bradley E. Schaefer”s moon phase algorithm. Ruby version based on JavaScript Phase Calculator by Stephen R. Schmitt
Instance Attribute Summary collapse
-
#days ⇒ Object
readonly
Returns the value of attribute days.
-
#dist ⇒ Object
readonly
Returns the value of attribute dist.
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#ll ⇒ Object
readonly
Returns the value of attribute ll.
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
Instance Method Summary collapse
-
#initialize(epoch = Time.now) ⇒ MoonCalc
constructor
Return the current (or input a date) moon.
Constructor Details
#initialize(epoch = Time.now) ⇒ MoonCalc
Return the current (or input a date) moon.
Moon.new
Moon.new(some_day)
Methods available:
phase => Phase of the moon as a sym
days => Moon days
icon => An integer from 0 to 29
dist => Distance in earth radii
ll => Moon ecliptic lat/lon
19 20 21 22 |
# File 'lib/moon_calc.rb', line 19 def initialize(epoch=Time.now) @epoch = epoch do_calc end |
Instance Attribute Details
#days ⇒ Object (readonly)
Returns the value of attribute days.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def days @days end |
#dist ⇒ Object (readonly)
Returns the value of attribute dist.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def dist @dist end |
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def epoch @epoch end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def icon @icon end |
#ll ⇒ Object (readonly)
Returns the value of attribute ll.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def ll @ll end |
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
6 7 8 |
# File 'lib/moon_calc.rb', line 6 def phase @phase end |