Class: Astronoby::LunarEclipse
- Inherits:
-
Object
- Object
- Astronoby::LunarEclipse
- Defined in:
- lib/astronoby/events/lunar_eclipse.rb
Overview
A lunar eclipse: a geocentric passage of the Moon through Earth’s shadow. Immutable; built by LunarEclipseCalculator.
The penumbral phase is always present. The partial phase is present for partial and total eclipses, and the total phase only for total eclipses.
Constant Summary collapse
- PENUMBRAL =
:penumbral- PARTIAL =
:partial- TOTAL =
:total
Instance Attribute Summary collapse
-
#gamma ⇒ Float
readonly
Least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse, in Earth radii, positive when the Moon passes north of the axis.
-
#instant ⇒ Astronoby::Instant
(also: #greatest_eclipse)
readonly
Greatest eclipse, when the Moon’s centre is least distant from the axis of Earth’s shadow.
-
#kind ⇒ Symbol
readonly
PENUMBRAL,PARTIALorTOTAL. -
#partial ⇒ Astronoby::EclipsePhase?
readonly
The partial phase, present for partial and total eclipses.
-
#penumbral ⇒ Astronoby::EclipsePhase
readonly
The penumbral phase (always present).
-
#penumbral_magnitude ⇒ Float
readonly
Fraction of the Moon’s diameter immersed in the penumbra at greatest eclipse.
-
#shadow_axis_distance ⇒ Astronoby::Distance
readonly
Least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse.
-
#total ⇒ Astronoby::EclipsePhase?
readonly
The total phase (totality), present only for total eclipses.
-
#umbral_magnitude ⇒ Float
readonly
Fraction of the Moon’s diameter immersed in the umbra at greatest eclipse (negative when the Moon misses the umbra).
Instance Method Summary collapse
-
#initialize(instant:, kind:, umbral_magnitude:, penumbral_magnitude:, gamma:, shadow_axis_distance:, penumbral:, partial: nil, total: nil) ⇒ LunarEclipse
constructor
A new instance of LunarEclipse.
-
#partial? ⇒ Boolean
True for a partial eclipse.
-
#penumbral? ⇒ Boolean
True for a penumbral eclipse (the Moon misses the umbra).
-
#total? ⇒ Boolean
True for a total eclipse.
Constructor Details
#initialize(instant:, kind:, umbral_magnitude:, penumbral_magnitude:, gamma:, shadow_axis_distance:, penumbral:, partial: nil, total: nil) ⇒ LunarEclipse
Returns a new instance of LunarEclipse.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 61 def initialize( instant:, kind:, umbral_magnitude:, penumbral_magnitude:, gamma:, shadow_axis_distance:, penumbral:, partial: nil, total: nil ) @instant = instant @kind = kind @umbral_magnitude = umbral_magnitude @penumbral_magnitude = penumbral_magnitude @gamma = gamma @shadow_axis_distance = shadow_axis_distance @penumbral = penumbral @partial = partial @total = total freeze end |
Instance Attribute Details
#gamma ⇒ Float (readonly)
Returns least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse, in Earth radii, positive when the Moon passes north of the axis.
33 34 35 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 33 def gamma @gamma end |
#instant ⇒ Astronoby::Instant (readonly) Also known as: greatest_eclipse
Returns greatest eclipse, when the Moon’s centre is least distant from the axis of Earth’s shadow.
16 17 18 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 16 def instant @instant end |
#kind ⇒ Symbol (readonly)
Returns PENUMBRAL, PARTIAL or TOTAL.
20 21 22 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 20 def kind @kind end |
#partial ⇒ Astronoby::EclipsePhase? (readonly)
Returns the partial phase, present for partial and total eclipses.
45 46 47 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 45 def partial @partial end |
#penumbral ⇒ Astronoby::EclipsePhase (readonly)
Returns the penumbral phase (always present).
41 42 43 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 41 def penumbral @penumbral end |
#penumbral_magnitude ⇒ Float (readonly)
Returns fraction of the Moon’s diameter immersed in the penumbra at greatest eclipse.
28 29 30 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 28 def penumbral_magnitude @penumbral_magnitude end |
#shadow_axis_distance ⇒ Astronoby::Distance (readonly)
Returns least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse. This is the unsigned length of which gamma is the value in Earth radii.
38 39 40 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 38 def shadow_axis_distance @shadow_axis_distance end |
#total ⇒ Astronoby::EclipsePhase? (readonly)
Returns the total phase (totality), present only for total eclipses.
49 50 51 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 49 def total @total end |
#umbral_magnitude ⇒ Float (readonly)
Returns fraction of the Moon’s diameter immersed in the umbra at greatest eclipse (negative when the Moon misses the umbra).
24 25 26 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 24 def umbral_magnitude @umbral_magnitude end |
Instance Method Details
#partial? ⇒ Boolean
Returns true for a partial eclipse.
90 91 92 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 90 def partial? @kind == PARTIAL end |
#penumbral? ⇒ Boolean
Returns true for a penumbral eclipse (the Moon misses the umbra).
85 86 87 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 85 def penumbral? @kind == PENUMBRAL end |
#total? ⇒ Boolean
Returns true for a total eclipse.
95 96 97 |
# File 'lib/astronoby/events/lunar_eclipse.rb', line 95 def total? @kind == TOTAL end |