class Zakuro::Gihou::Lunar::Location
Location
入暦
Constants
- ANOMALISTIC_MONTH
@return [Cycle::LunarRemainder] 1近点月
- QUARTER
@return [Cycle::LunarRemainder] 弦
Public Class Methods
new(lunar_age:, western_year:)
click to toggle source
初期化
@param [Cycle::LunarRemainder] lunar_age 天正閏余(大余小余) @param [Integer] western_year 西暦年
Calls superclass method
Zakuro::Calculation::Lunar::AbstractLocation::new
# File lib/zakuro/version/gihou/stella/lunar/location.rb, line 30 def initialize(lunar_age:, western_year:) super(lunar_age: lunar_age, western_year: western_year) end
Public Instance Methods
add_quarter()
click to toggle source
弦の分だけ月地点を進める
# File lib/zakuro/version/gihou/stella/lunar/location.rb, line 49 def add_quarter remainder.add!(QUARTER) end
run()
click to toggle source
入暦を計算する
# File lib/zakuro/version/gihou/stella/lunar/location.rb, line 37 def run if calculated decrease(limit: ANOMALISTIC_MONTH) return end first end
Private Instance Methods
decrease(limit:)
click to toggle source
大余小余に合わせて減算する(折り返す)
@param [Cycle::LunarRemainder] limit 上限
# File lib/zakuro/version/gihou/stella/lunar/location.rb, line 72 def decrease(limit:) return if remainder < limit remainder.sub!(limit) end
first()
click to toggle source
初回計算
# File lib/zakuro/version/gihou/stella/lunar/location.rb, line 58 def first @remainder = Localization.first_remainder( lunar_age: remainder, western_year: western_year ) decrease(limit: ANOMALISTIC_MONTH) @calculated = true end