Class: Astroscript::Midpoint
- Defined in:
- lib/astroscript/body/midpoint.rb
Constant Summary
Constants inherited from Body
Body::ANGLES, Body::AVG_VELOCITY, Body::MAX_VELOCITY, Body::ORBS, Body::SPEED_ORDER, Body::STATIONARY_VELOCITY
Instance Attribute Summary collapse
-
#bodies ⇒ Object
readonly
Returns the value of attribute bodies.
Attributes inherited from Body
#altitude, #antipode, #azimuth, #calc, #decl, #distance, #harmonic, #hdist, #hlat, #hlon, #hvel, #lat, #ra, #velocity
Instance Method Summary collapse
- #abbr ⇒ Object
- #calculate! ⇒ Object
-
#initialize(b1, b2, opts = {}) ⇒ Midpoint
constructor
A new instance of Midpoint.
- #inspect ⇒ Object
- #symbol ⇒ Object
- #to_sym ⇒ Object
Methods inherited from Body
#*, #==, #closer_to_sun?, #decan, #distance_to_sun, #duad, #dwad, #element, #element_sym, #feminine?, #flip, #flip!, #gate, #handle, #harmonic_sign, #harmonic_signs, #harmonize, #harmonize!, #house, #in_detriment?, #in_domicile?, #in_exaltation?, #in_fall?, #inner?, #is_angle?, #lon, #luminary?, #masculine?, #meridian_degree, #midpoint?, #modality, #name, #navamsha, #outer?, #pentan, #personal_angle?, phase, #prefix, #prime_degree, #print, #radix, #relative_velocity, #retrograde?, #ruler, #sign, #sign_and_house, #sign_i, #sign_sym, #speed_order, #stationary?, #subduad, #subdwad, #subpentan, #to_dms, #to_json, #to_s, #transit!, #transit?, #triple_harmonic_signs, #yang?, #yin?
Constructor Details
#initialize(b1, b2, opts = {}) ⇒ Midpoint
Returns a new instance of Midpoint.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/astroscript/body/midpoint.rb', line 7 def initialize(b1, b2, opts = {}) @harmonic = opts[:harmonic] || 1 @bodies = [b1, b2] @name = abbr.sub(operator, "_") @symbol = @bodies.map(&:symbol).join(operator) @lon = @bodies.map(&:lon).avg if ((@lon - b1.lon).abs % 360) > 90 @lon = (@lon + 180) % 360 # flip! end update! end |
Instance Attribute Details
#bodies ⇒ Object (readonly)
Returns the value of attribute bodies.
5 6 7 |
# File 'lib/astroscript/body/midpoint.rb', line 5 def bodies @bodies end |
Instance Method Details
#abbr ⇒ Object
23 24 25 |
# File 'lib/astroscript/body/midpoint.rb', line 23 def abbr bodies.map(&:abbr).join(operator) end |
#calculate! ⇒ Object
19 20 21 |
# File 'lib/astroscript/body/midpoint.rb', line 19 def calculate! bodies.each(&:calculate!) end |
#inspect ⇒ Object
35 36 37 38 39 |
# File 'lib/astroscript/body/midpoint.rb', line 35 def inspect return super unless defined?(IRB) "#{bodies.first.abbr}/#{bodies.last.abbr}\t#{AstroHelper.deg_to_s(lon)}" end |
#symbol ⇒ Object
27 28 29 |
# File 'lib/astroscript/body/midpoint.rb', line 27 def symbol bodies.map(&:symbol).join(operator) end |
#to_sym ⇒ Object
31 32 33 |
# File 'lib/astroscript/body/midpoint.rb', line 31 def to_sym abbr.to_sym end |