lib/zakuro/version/daien/stella/lunar/location.rb in zakuro-0.9.4 vs lib/zakuro/version/daien/stella/lunar/location.rb in zakuro-1.0.0

- old
+ new

@@ -7,70 +7,73 @@ require_relative './localization' # :nodoc: module Zakuro # :nodoc: - module Daien + module Version # :nodoc: - module Lunar - # - # Location 入暦 - # - class Location < Calculation::Lunar::AbstractLocation - # @return [Cycle::LunarRemainder] 1近点月 - ANOMALISTIC_MONTH = Const::Remainder::Lunar::ANOMALISTIC_MONTH - # @return [Cycle::LunarRemainder] 弦 - QUARTER = Const::Remainder::Lunar::QUARTER - + module Daien + # :nodoc: + module Lunar # - # 初期化 + # Location 入暦 # - # @param [Cycle::LunarRemainder] lunar_age 天正閏余(大余小余) - # @param [Integer] western_year 西暦年 - # - def initialize(lunar_age:, western_year:) - super( - lunar_age: lunar_age, - quarter: QUARTER, - western_year: western_year - ) - end + class Location < Calculation::Lunar::AbstractLocation + # @return [Cycle::LunarRemainder] 1近点月 + ANOMALISTIC_MONTH = Const::Remainder::Lunar::ANOMALISTIC_MONTH + # @return [Cycle::LunarRemainder] 弦 + QUARTER = Const::Remainder::Lunar::QUARTER - # - # 入暦を計算する - # - def run - if calculated - decrease(limit: ANOMALISTIC_MONTH) - return + # + # 初期化 + # + # @param [Cycle::LunarRemainder] lunar_age 天正閏余(大余小余) + # @param [Integer] western_year 西暦年 + # + def initialize(lunar_age:, western_year:) + super( + lunar_age: lunar_age, + quarter: QUARTER, + western_year: western_year + ) end - first - end + # + # 入暦を計算する + # + def run + if calculated + decrease(limit: ANOMALISTIC_MONTH) + return + end - private + first + end - # - # 初回計算 - # - def first - @remainder = Localization.first_remainder( - lunar_age: remainder, western_year: western_year - ) - decrease(limit: ANOMALISTIC_MONTH) + private - @calculated = true - end + # + # 初回計算 + # + def first + @remainder = Localization.first_remainder( + lunar_age: remainder, western_year: western_year + ) + decrease(limit: ANOMALISTIC_MONTH) - # - # 大余小余に合わせて減算する(折り返す) - # - # @param [Cycle::LunarRemainder] limit 上限 - # - def decrease(limit:) - return if remainder < limit + @calculated = true + end - remainder.sub!(limit) + # + # 大余小余に合わせて減算する(折り返す) + # + # @param [Cycle::LunarRemainder] limit 上限 + # + def decrease(limit:) + return if remainder < limit + + remainder.sub!(limit) + end end end end end end