Class: Astroscript::MethodBody

Inherits:
Body
  • Object
show all
Defined in:
lib/astroscript/body/method_body.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

Attributes inherited from Body

#abbr, #altitude, #antipode, #azimuth, #calc, #decl, #distance, #harmonic, #hdist, #hlat, #hlon, #hvel, #lat, #ra, #velocity

Instance Method Summary collapse

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?, #inspect, #is_angle?, #lon, #luminary?, #masculine?, #meridian_degree, #midpoint?, #modality, #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(deg, name, symbol = nil, _abbr = nil, chart:) ⇒ MethodBody

Returns a new instance of MethodBody.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/astroscript/body/method_body.rb', line 7

def initialize(deg, name, symbol = nil, _abbr = nil, chart:)
  @lon = deg
  @name = name
  @chart = chart
  @calc = chart.calc
  @harmonic = 1
  body = SwissEphemeris::BODIES.select{|_k, v| v[:name] == name }
  if body.empty?
    $logger.warn "Unknown body: #{name}"
  else
    @abbr = body.keys.first
    @symbol = body[@abbr][:symbol] || symbol
  end
  update!
end

Instance Attribute Details

#chartObject

Returns the value of attribute chart.



5
6
7
# File 'lib/astroscript/body/method_body.rb', line 5

def chart
  @chart
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/astroscript/body/method_body.rb', line 5

def name
  @name
end

#symbolObject

Returns the value of attribute symbol.



5
6
7
# File 'lib/astroscript/body/method_body.rb', line 5

def symbol
  @symbol
end

Instance Method Details

#calculate!Object

name should equal method



23
24
25
# File 'lib/astroscript/body/method_body.rb', line 23

def calculate! # name should equal method
  @lon = @chart.send name
end