Class: Astrolith::Charts::BaseChart
- Inherits:
-
Object
- Object
- Astrolith::Charts::BaseChart
- Defined in:
- lib/astrolith/charts/base_chart.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#angles ⇒ Object
readonly
Returns the value of attribute angles.
-
#aspects ⇒ Object
readonly
Returns the value of attribute aspects.
-
#coordinates ⇒ Object
readonly
Returns the value of attribute coordinates.
-
#datetime ⇒ Object
readonly
Returns the value of attribute datetime.
-
#house_system ⇒ Object
readonly
Returns the value of attribute house_system.
-
#houses ⇒ Object
readonly
Returns the value of attribute houses.
-
#julian_day ⇒ Object
readonly
Returns the value of attribute julian_day.
-
#planets ⇒ Object
readonly
Returns the value of attribute planets.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Instance Method Summary collapse
-
#initialize(datetime:, latitude:, longitude:, timezone: 'UTC', house_system: :placidus) ⇒ BaseChart
constructor
A new instance of BaseChart.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(datetime:, latitude:, longitude:, timezone: 'UTC', house_system: :placidus) ⇒ BaseChart
Returns a new instance of BaseChart.
7 8 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/astrolith/charts/base_chart.rb', line 7 def initialize(datetime:, latitude:, longitude:, timezone: 'UTC', house_system: :placidus) # Parse inputs @datetime = Input::DateTime.new(datetime) @coordinates = Input::Coordinates.new(lat: latitude, lon: longitude) @timezone = Input::Timezone.new(timezone, @datetime.datetime) @house_system = house_system # Calculate Julian Day @julian_day = @datetime.to_julian_day(@timezone.offset_hours) # Initialize calculators @position_calc = Calculations::Positions.new( julian_day: @julian_day, latitude: @coordinates.latitude, longitude: @coordinates.longitude ) @house_calc = Calculations::Houses.new( julian_day: @julian_day, latitude: @coordinates.latitude, longitude: @coordinates.longitude, house_system: @house_system ) # Perform calculations calculate! end |
Instance Attribute Details
#angles ⇒ Object (readonly)
Returns the value of attribute angles.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def angles @angles end |
#aspects ⇒ Object (readonly)
Returns the value of attribute aspects.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def aspects @aspects end |
#coordinates ⇒ Object (readonly)
Returns the value of attribute coordinates.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def coordinates @coordinates end |
#datetime ⇒ Object (readonly)
Returns the value of attribute datetime.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def datetime @datetime end |
#house_system ⇒ Object (readonly)
Returns the value of attribute house_system.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def house_system @house_system end |
#houses ⇒ Object (readonly)
Returns the value of attribute houses.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def houses @houses end |
#julian_day ⇒ Object (readonly)
Returns the value of attribute julian_day.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def julian_day @julian_day end |
#planets ⇒ Object (readonly)
Returns the value of attribute planets.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def planets @planets end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
4 5 6 |
# File 'lib/astrolith/charts/base_chart.rb', line 4 def timezone @timezone end |
Instance Method Details
#to_hash ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/astrolith/charts/base_chart.rb', line 39 def to_hash { metadata: , planets: format_planets, houses: format_houses, angles: format_angles, aspects: @aspects } end |
#to_json(*args) ⇒ Object
35 36 37 |
# File 'lib/astrolith/charts/base_chart.rb', line 35 def to_json(*args) to_hash.to_json(*args) end |