Class: Astronoby::GreatestElongation
- Inherits:
-
Object
- Object
- Astronoby::GreatestElongation
- Defined in:
- lib/astronoby/events/greatest_elongation.rb
Constant Summary collapse
- EASTERN =
:eastern- WESTERN =
:western
Instance Attribute Summary collapse
-
#angle ⇒ Astronoby::Angle
readonly
The Sun-Earth-body angle at that instant.
-
#body ⇒ Astronoby::Body
readonly
The body reaching greatest elongation.
-
#direction ⇒ Symbol
readonly
EASTERNorWESTERN. -
#instant ⇒ Astronoby::Instant
readonly
When the greatest elongation occurs.
Class Method Summary collapse
-
.eastern(instant:, body:, angle:) ⇒ Astronoby::GreatestElongation
A greatest eastern elongation.
-
.western(instant:, body:, angle:) ⇒ Astronoby::GreatestElongation
A greatest western elongation.
Instance Method Summary collapse
-
#eastern? ⇒ Boolean
True for a greatest eastern elongation.
-
#initialize(instant:, body:, angle:, direction:) ⇒ GreatestElongation
constructor
A new instance of GreatestElongation.
-
#western? ⇒ Boolean
True for a greatest western elongation.
Constructor Details
#initialize(instant:, body:, angle:, direction:) ⇒ GreatestElongation
Returns a new instance of GreatestElongation.
40 41 42 43 44 45 46 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 40 def initialize(instant:, body:, angle:, direction:) @instant = instant @body = body @angle = angle @direction = direction freeze end |
Instance Attribute Details
#angle ⇒ Astronoby::Angle (readonly)
Returns the Sun-Earth-body angle at that instant.
31 32 33 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 31 def angle @angle end |
#body ⇒ Astronoby::Body (readonly)
Returns the body reaching greatest elongation.
28 29 30 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 28 def body @body end |
#direction ⇒ Symbol (readonly)
Returns EASTERN or WESTERN.
34 35 36 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 34 def direction @direction end |
#instant ⇒ Astronoby::Instant (readonly)
Returns when the greatest elongation occurs.
25 26 27 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 25 def instant @instant end |
Class Method Details
.eastern(instant:, body:, angle:) ⇒ Astronoby::GreatestElongation
Returns a greatest eastern elongation.
12 13 14 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 12 def self.eastern(instant:, body:, angle:) new(instant: instant, body: body, angle: angle, direction: EASTERN) end |
.western(instant:, body:, angle:) ⇒ Astronoby::GreatestElongation
Returns a greatest western elongation.
20 21 22 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 20 def self.western(instant:, body:, angle:) new(instant: instant, body: body, angle: angle, direction: WESTERN) end |
Instance Method Details
#eastern? ⇒ Boolean
Returns true for a greatest eastern elongation.
49 50 51 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 49 def eastern? @direction == EASTERN end |
#western? ⇒ Boolean
Returns true for a greatest western elongation.
54 55 56 |
# File 'lib/astronoby/events/greatest_elongation.rb', line 54 def western? @direction == WESTERN end |