Class: Astronoby::Conjunction
- Inherits:
-
Object
- Object
- Astronoby::Conjunction
- Defined in:
- lib/astronoby/events/conjunction.rb
Constant Summary collapse
- INFERIOR =
:inferior- SUPERIOR =
:superior
Instance Attribute Summary collapse
-
#body ⇒ Astronoby::Body
readonly
The body in conjunction with the Sun.
-
#instant ⇒ Astronoby::Instant
readonly
When the conjunction occurs.
-
#subtype ⇒ Symbol
readonly
INFERIORorSUPERIOR.
Class Method Summary collapse
-
.inferior(instant:, body:) ⇒ Astronoby::Conjunction
An inferior conjunction.
-
.superior(instant:, body:) ⇒ Astronoby::Conjunction
A superior conjunction.
Instance Method Summary collapse
-
#inferior? ⇒ Boolean
True for an inferior conjunction.
-
#initialize(instant:, body:, subtype:) ⇒ Conjunction
constructor
A new instance of Conjunction.
-
#superior? ⇒ Boolean
True for a superior conjunction.
Constructor Details
#initialize(instant:, body:, subtype:) ⇒ Conjunction
Returns a new instance of Conjunction.
34 35 36 37 38 39 |
# File 'lib/astronoby/events/conjunction.rb', line 34 def initialize(instant:, body:, subtype:) @instant = instant @body = body @subtype = subtype freeze end |
Instance Attribute Details
#body ⇒ Astronoby::Body (readonly)
Returns the body in conjunction with the Sun.
26 27 28 |
# File 'lib/astronoby/events/conjunction.rb', line 26 def body @body end |
#instant ⇒ Astronoby::Instant (readonly)
Returns when the conjunction occurs.
23 24 25 |
# File 'lib/astronoby/events/conjunction.rb', line 23 def instant @instant end |
#subtype ⇒ Symbol (readonly)
Returns INFERIOR or SUPERIOR.
29 30 31 |
# File 'lib/astronoby/events/conjunction.rb', line 29 def subtype @subtype end |
Class Method Details
.inferior(instant:, body:) ⇒ Astronoby::Conjunction
Returns an inferior conjunction.
11 12 13 |
# File 'lib/astronoby/events/conjunction.rb', line 11 def self.inferior(instant:, body:) new(instant: instant, body: body, subtype: INFERIOR) end |
.superior(instant:, body:) ⇒ Astronoby::Conjunction
Returns a superior conjunction.
18 19 20 |
# File 'lib/astronoby/events/conjunction.rb', line 18 def self.superior(instant:, body:) new(instant: instant, body: body, subtype: SUPERIOR) end |
Instance Method Details
#inferior? ⇒ Boolean
Returns true for an inferior conjunction.
42 43 44 |
# File 'lib/astronoby/events/conjunction.rb', line 42 def inferior? @subtype == INFERIOR end |
#superior? ⇒ Boolean
Returns true for a superior conjunction.
47 48 49 |
# File 'lib/astronoby/events/conjunction.rb', line 47 def superior? @subtype == SUPERIOR end |