Sha256: 50954c93590d5fdbe5c4c7a943965d006c502fd1db4e5c635b6c37051cf55c04

Contents?: true

Size: 1.5 KB

Versions: 7

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

require_relative '../../../../output/logger'

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

# :nodoc:
module Zakuro
  # :nodoc:
  module Daien
    # :nodoc:
    module Origin
      #
      # WinterSolstice 冬至
      #
      module WinterSolstice
        # @return [Integer] 通余
        REMAINDER_ALL_YEAR = Const::Number::Derivation::REMAINDER_ALL_YEAR
        # @return [Integer] 60日
        SIXTY_DAYS = Const::Number::Derivation::SIXTY_DAYS
        # @return [Integer] 積年
        TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
        # @return [Integer] 暦の開始年
        BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR

        # @return [Output::Logger] ロガー
        LOGGER = Output::Logger.new(location: 'winter_solstice')

        # :reek:TooManyStatements { max_statements: 6 }

        #
        # 対象年の前年の冬至を求める
        #
        # @param [Integer] western_year 西暦年
        #
        # @return [Remainder] 前年の冬至
        #
        def self.get(western_year:)
          # 積年の開始から対象年までの年数
          total = TOTAL_YEAR + western_year - BEGIN_YEAR
          remainder_year = total % SIXTY_DAYS

          LOGGER.debug("[01]:#{remainder_year}")

          # 通余を使う
          winter_solstice_minute = (remainder_year * REMAINDER_ALL_YEAR) % SIXTY_DAYS

          LOGGER.debug("[02]:#{winter_solstice_minute}")

          Cycle::Remainder.new(total: winter_solstice_minute)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zakuro-0.7.2 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.7.0 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.6.1 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.6.0 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.5.0 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.4.0 lib/zakuro/version/daien/stella/origin/winter_solstice.rb
zakuro-0.3.0 lib/zakuro/version/daien/stella/origin/winter_solstice.rb