Class: RubyChartEngine::Charts::Transit

Inherits:
BaseChart
  • Object
show all
Defined in:
lib/ruby_chart_engine/charts/transit.rb

Instance Attribute Summary collapse

Attributes inherited from BaseChart

#angles, #aspects, #coordinates, #datetime, #house_system, #houses, #julian_day, #planets, #timezone

Instance Method Summary collapse

Methods inherited from BaseChart

#to_json

Constructor Details

#initialize(natal_chart_params:, transit_datetime:, house_system: :placidus) ⇒ Transit

Transit chart - current planetary positions compared to natal chart



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ruby_chart_engine/charts/transit.rb', line 9

def initialize(natal_chart_params:, transit_datetime:, house_system: :placidus)
  # Create natal chart if not provided
  @natal_chart = if natal_chart_params.is_a?(Natal)
                   natal_chart_params
                 else
                   Natal.new(**natal_chart_params)
                 end

  # Use natal chart location for transit chart
  # (transits are typically calculated for the natal location)
  super(
    datetime: transit_datetime,
    latitude: @natal_chart.coordinates.latitude,
    longitude: @natal_chart.coordinates.longitude,
    timezone: natal_chart_params[:timezone] || 'UTC',
    house_system: house_system
  )

  # Calculate aspects between transit planets and natal planets
  calculate_transit_aspects!
end

Instance Attribute Details

#natal_chartObject (readonly)

Returns the value of attribute natal_chart.



6
7
8
# File 'lib/ruby_chart_engine/charts/transit.rb', line 6

def natal_chart
  @natal_chart
end

#transit_aspectsObject (readonly)

Returns the value of attribute transit_aspects.



6
7
8
# File 'lib/ruby_chart_engine/charts/transit.rb', line 6

def transit_aspects
  @transit_aspects
end

Instance Method Details

#to_hashObject



31
32
33
34
35
36
37
# File 'lib/ruby_chart_engine/charts/transit.rb', line 31

def to_hash
  super.merge(
    chart_type: 'transit',
    natal_chart_metadata: @natal_chart.to_hash[:metadata],
    transit_aspects: @transit_aspects
  )
end