Sha256: af8ff7fae49ec56f7dda4f5c8daf0f2a90ae7874e0daa0843eb944bf5b84f595

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

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

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

# :nodoc:
module Zakuro
  # :nodoc:
  module Senmyou
    # :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

9 entries across 9 versions & 1 rubygems

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