Class: RubyChartEngine::Charts::Natal

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

Instance Attribute Summary

Attributes inherited from BaseChart

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

Instance Method Summary collapse

Methods inherited from BaseChart

#initialize, #to_json

Constructor Details

This class inherits a constructor from RubyChartEngine::Charts::BaseChart

Instance Method Details

#chart_shapeObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ruby_chart_engine/charts/natal.rb', line 35

def chart_shape
  # Analyze planetary distribution to determine chart shape
  # This is a simplified implementation
  longitudes = @planets.select { |k, _| PLANETS.keys.include?(k) }
                       .map { |_, v| v[:longitude] }
                       .sort

  return 'splash' if longitudes.empty?

  # Calculate the largest gap between consecutive planets
  gaps = []
  longitudes.each_with_index do |lon, i|
    next_lon = longitudes[(i + 1) % longitudes.length]
    gap = next_lon > lon ? next_lon - lon : (360 - lon) + next_lon
    gaps << gap
  end

  max_gap = gaps.max
  occupied_arc = 360 - max_gap

  case
  when max_gap > 240
    'bundle'
  when occupied_arc <= 120
    'bundle'
  when occupied_arc <= 180
    'bowl'
  when occupied_arc <= 240
    'bucket'
  when gaps.all? { |g| g > 20 && g < 60 }
    'splay'
  else
    'splash'
  end
end

#moon_phaseObject

Natal chart is the base chart type Additional natal-specific methods can be added here



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

def moon_phase
  sun_lon = @planets[:sun][:longitude]
  moon_lon = @planets[:moon][:longitude]

  phase_angle = (moon_lon - sun_lon) % 360

  case phase_angle
  when 0..45
    'New Moon'
  when 45..90
    'Waxing Crescent'
  when 90..135
    'First Quarter'
  when 135..180
    'Waxing Gibbous'
  when 180..225
    'Full Moon'
  when 225..270
    'Waning Gibbous'
  when 270..315
    'Last Quarter'
  when 315..360
    'Waning Crescent'
  end
end

#to_hashObject



71
72
73
74
75
76
# File 'lib/ruby_chart_engine/charts/natal.rb', line 71

def to_hash
  super.merge(
    moon_phase: moon_phase,
    chart_shape: chart_shape
  )
end