Sha256: 248fe5328f714783ea64e9392251b3744a7597e04094ddd6b5182b84d4ed5146

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require_relative '../../const/number'

# :nodoc:
module Zakuro
  # :nodoc:
  module Gihou
    # :nodoc:
    module Lunar
      #
      # Localization 入暦特定
      #
      module Localization
        # @return [Integer] 1近点月
        ANOMALISTIC_MONTH = Const::Number::Cycle::ANOMALISTIC_MONTH
        # @return [Integer] 積年
        TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
        # @return [Integer] 開始年
        BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR
        # @return [Integer] 年
        YEAR = Const::Number::Cycle::YEAR

        class << self
          #
          # 対象年の最初の入暦を求める
          #
          # @param [Remainder] lunar_age 天正閏余
          # @param [Integer] western_year 西暦年
          #
          # @return [Cycle::LunarRemainder] 入暦
          #
          def first_remainder(lunar_age:, western_year:)
            # 積年の開始から対象年までの年数
            total_year = TOTAL_YEAR + western_year - BEGIN_YEAR

            # 通積分 - 天正閏余
            total_day = total_year * YEAR - lunar_age.to_minute

            Cycle::LunarRemainder.new(total: (total_day % ANOMALISTIC_MONTH))
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zakuro-0.9.4 lib/zakuro/version/gihou/stella/lunar/localization.rb
zakuro-0.9.3 lib/zakuro/version/gihou/stella/lunar/localization.rb
zakuro-0.9.2 lib/zakuro/version/gihou/stella/lunar/localization.rb
zakuro-0.9.1 lib/zakuro/version/gihou/stella/lunar/localization.rb
zakuro-0.9.0 lib/zakuro/version/gihou/stella/lunar/localization.rb
zakuro-0.8.0 lib/zakuro/version/gihou/stella/lunar/localization.rb