zakuro 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +20 -18
 - data/VERSION +1 -1
 - data/doc/condition.md +3 -1
 - data/doc/dropped_date.md +25 -0
 - data/doc/expection.md +11 -0
 - data/doc/operation/csv/month.csv +5 -5
 - data/doc/operation/operation.xlsx +0 -0
 - data/doc/vanished_date.md +26 -0
 - data/lib/zakuro/calculation/cycle/abstract_remainder.rb +26 -0
 - data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +1 -1
 - data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +2 -2
 - data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +6 -2
 - data/lib/zakuro/calculation/era/gengou/internal/counter.rb +5 -5
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +12 -5
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +14 -8
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +3 -2
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +4 -2
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +5 -3
 - data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +10 -5
 - data/lib/zakuro/calculation/era/gengou/named_scroll.rb +5 -2
 - data/lib/zakuro/calculation/monthly/initialized_month.rb +4 -2
 - data/lib/zakuro/calculation/monthly/meta/all_solar_term.rb +64 -0
 - data/lib/zakuro/calculation/monthly/meta/meta_collector.rb +80 -0
 - data/lib/zakuro/calculation/monthly/meta.rb +60 -0
 - data/lib/zakuro/calculation/monthly/month.rb +60 -5
 - data/lib/zakuro/calculation/monthly/operated_month.rb +6 -3
 - data/lib/zakuro/calculation/option/dropped_date/location.rb +12 -23
 - data/lib/zakuro/calculation/option/vanished_date/location.rb +9 -2
 - data/lib/zakuro/calculation/range/abstract_full_range.rb +19 -2
 - data/lib/zakuro/calculation/range/abstract_operation_range.rb +20 -2
 - data/lib/zakuro/calculation/range/dated_full_range.rb +3 -1
 - data/lib/zakuro/calculation/range/dated_operation_range.rb +3 -1
 - data/lib/zakuro/calculation/range/medieval_annual_range.rb +1 -1
 - data/lib/zakuro/calculation/range/named_full_range.rb +3 -1
 - data/lib/zakuro/calculation/range/named_operation_range.rb +3 -1
 - data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +2 -1
 - data/lib/zakuro/calculation/range/transfer/year_boundary.rb +10 -8
 - data/lib/zakuro/calculation/stella/solar/abstract_average.rb +8 -34
 - data/lib/zakuro/calculation/summary/internal/option.rb +51 -25
 - data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +1 -1
 - data/lib/zakuro/era/japan/calendar.rb +2 -2
 - data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +1 -1
 - data/lib/zakuro/era/japan/gengou/alignment.rb +14 -2
 - data/lib/zakuro/era/japan/gengou/resource/parser.rb +83 -25
 - data/lib/zakuro/era/japan/gengou/resource/type.rb +81 -26
 - data/lib/zakuro/era/japan/gengou/resource/validator.rb +102 -23
 - data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +1123 -375
 - data/lib/zakuro/era/japan/gengou/resource/yaml/set-002-from-north.yaml +487 -163
 - data/lib/zakuro/era/japan/gengou/resource/yaml/set-003-modern.yaml +30 -10
 - data/lib/zakuro/era/japan/gengou/resource.rb +16 -0
 - data/lib/zakuro/era/japan/gengou.rb +7 -4
 - data/lib/zakuro/era/western/calendar.rb +5 -11
 - data/lib/zakuro/era/western/date_text.rb +40 -0
 - data/lib/zakuro/gateway/locale/date.rb +2 -2
 - data/lib/zakuro/operation/month/validator.rb +7 -1
 - data/lib/zakuro/operation/yaml/month.yaml +15 -15
 - data/lib/zakuro/output/logger.rb +21 -3
 - data/lib/zakuro/tools/remainder_comparer.rb +97 -0
 - metadata +7 -2
 
| 
         @@ -0,0 +1,80 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative '../../../era/western/calendar'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative '../month'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative './all_solar_term'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # :nodoc:
         
     | 
| 
      
 10 
     | 
    
         
            +
            module Zakuro
         
     | 
| 
      
 11 
     | 
    
         
            +
              # :nodoc:
         
     | 
| 
      
 12 
     | 
    
         
            +
              module Calculation
         
     | 
| 
      
 13 
     | 
    
         
            +
                # :nodoc:
         
     | 
| 
      
 14 
     | 
    
         
            +
                module Monthly
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # MetaCollector メタ情報の収集
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # 前月データを次のように扱う
         
     | 
| 
      
 19 
     | 
    
         
            +
                  # 1. 範囲内の最初の月は無視する
         
     | 
| 
      
 20 
     | 
    
         
            +
                  #   * 元号範囲は常に余裕を持って取っている
         
     | 
| 
      
 21 
     | 
    
         
            +
                  #   * 求めたい日付よりは常に1ヶ月以上を計算範囲にしている
         
     | 
| 
      
 22 
     | 
    
         
            +
                  #   * 元嘉暦の最初の月は無視する
         
     | 
| 
      
 23 
     | 
    
         
            +
                  #     * 元嘉暦は正月始まり
         
     | 
| 
      
 24 
     | 
    
         
            +
                  #     * 初めの月は手前の月がないため前月がない
         
     | 
| 
      
 25 
     | 
    
         
            +
                  #     * 没日・滅日の対象外のため不要とする
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # 2. 年境界を解決した後の1年データで再度移行する
         
     | 
| 
      
 27 
     | 
    
         
            +
                  #   * 冬至データの最初の月には前月がない
         
     | 
| 
      
 28 
     | 
    
         
            +
                  #   * 1年データにすることで前月が生まれるので再度移行する
         
     | 
| 
      
 29 
     | 
    
         
            +
                  # 3. 暦の切り替えを考慮する
         
     | 
| 
      
 30 
     | 
    
         
            +
                  #   * 手前の月が異なる暦であれば、その月のデータを参照する
         
     | 
| 
      
 31 
     | 
    
         
            +
                  module MetaCollector
         
     | 
| 
      
 32 
     | 
    
         
            +
                    class << self
         
     | 
| 
      
 33 
     | 
    
         
            +
                      #
         
     | 
| 
      
 34 
     | 
    
         
            +
                      # メタ情報を取得する
         
     | 
| 
      
 35 
     | 
    
         
            +
                      #
         
     | 
| 
      
 36 
     | 
    
         
            +
                      # @param [Monthly::Month] before_month 前月
         
     | 
| 
      
 37 
     | 
    
         
            +
                      # @param [Monthly::Month] current_month 当月
         
     | 
| 
      
 38 
     | 
    
         
            +
                      #
         
     | 
| 
      
 39 
     | 
    
         
            +
                      # @return [Monthly::Meta] 当月のメタ情報
         
     | 
| 
      
 40 
     | 
    
         
            +
                      #
         
     | 
| 
      
 41 
     | 
    
         
            +
                      def get(before_month:, current_month:)
         
     | 
| 
      
 42 
     | 
    
         
            +
                        Monthly::Meta.new(
         
     | 
| 
      
 43 
     | 
    
         
            +
                          all_solar_terms: all_solar_terms(
         
     | 
| 
      
 44 
     | 
    
         
            +
                            before_month: before_month, current_month: current_month
         
     | 
| 
      
 45 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 46 
     | 
    
         
            +
                          last_average_remainder: last_average_remainder(
         
     | 
| 
      
 47 
     | 
    
         
            +
                            before_month: before_month
         
     | 
| 
      
 48 
     | 
    
         
            +
                          )
         
     | 
| 
      
 49 
     | 
    
         
            +
                        )
         
     | 
| 
      
 50 
     | 
    
         
            +
                      end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                      private
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                      #
         
     | 
| 
      
 55 
     | 
    
         
            +
                      # 全ての二十四節気を取得する
         
     | 
| 
      
 56 
     | 
    
         
            +
                      #
         
     | 
| 
      
 57 
     | 
    
         
            +
                      # @param [Monthly::Month] before_month 前月
         
     | 
| 
      
 58 
     | 
    
         
            +
                      # @param [Monthly::Month] current_month 当月
         
     | 
| 
      
 59 
     | 
    
         
            +
                      #
         
     | 
| 
      
 60 
     | 
    
         
            +
                      # @return [Array<Cycle::AbstractSolarTerm>] その月の全ての二十四節気
         
     | 
| 
      
 61 
     | 
    
         
            +
                      #
         
     | 
| 
      
 62 
     | 
    
         
            +
                      def all_solar_terms(before_month:, current_month:)
         
     | 
| 
      
 63 
     | 
    
         
            +
                        AllSolarTerm.get(before_month: before_month, current_month: current_month)
         
     | 
| 
      
 64 
     | 
    
         
            +
                      end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                      #
         
     | 
| 
      
 67 
     | 
    
         
            +
                      # 前月の経朔を取得する
         
     | 
| 
      
 68 
     | 
    
         
            +
                      #
         
     | 
| 
      
 69 
     | 
    
         
            +
                      # @param [Monthly::Month] before_month 前月
         
     | 
| 
      
 70 
     | 
    
         
            +
                      #
         
     | 
| 
      
 71 
     | 
    
         
            +
                      # @return [Cycle::AbstractRemainder] 前月の経朔
         
     | 
| 
      
 72 
     | 
    
         
            +
                      #
         
     | 
| 
      
 73 
     | 
    
         
            +
                      def last_average_remainder(before_month:)
         
     | 
| 
      
 74 
     | 
    
         
            +
                        before_month.first_day.average_remainder
         
     | 
| 
      
 75 
     | 
    
         
            +
                      end
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,60 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative '../cycle/abstract_remainder'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            # :nodoc:
         
     | 
| 
      
 6 
     | 
    
         
            +
            module Zakuro
         
     | 
| 
      
 7 
     | 
    
         
            +
              # :nodoc:
         
     | 
| 
      
 8 
     | 
    
         
            +
              module Calculation
         
     | 
| 
      
 9 
     | 
    
         
            +
                # :nodoc:
         
     | 
| 
      
 10 
     | 
    
         
            +
                module Monthly
         
     | 
| 
      
 11 
     | 
    
         
            +
                  #
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # Meta 付加情報
         
     | 
| 
      
 13 
     | 
    
         
            +
                  #
         
     | 
| 
      
 14 
     | 
    
         
            +
                  class Meta
         
     | 
| 
      
 15 
     | 
    
         
            +
                    # @return [Array<Cycle::AbstractSolarTerm>] 月の全ての二十四節気
         
     | 
| 
      
 16 
     | 
    
         
            +
                    # @note 前提として、『日本暦日原典』にある月ごとの二十四節気は、その月の全ての二十四節気ではない
         
     | 
| 
      
 17 
     | 
    
         
            +
                    #
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # 下表を例に取った場合、『日本暦日原典』の二十四節気連番のうち、2と3がその月の二十四節気となる
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # ここで、当月のうち2より手前の日は前月の1の二十四節気に属しており、当月だけでは参照できない
         
     | 
| 
      
 20 
     | 
    
         
            +
                    # この参照を可能とするための情報となる
         
     | 
| 
      
 21 
     | 
    
         
            +
                    #
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # |No| 項目          | 前月                |  当月              | 次月                |
         
     | 
| 
      
 23 
     | 
    
         
            +
                    # |1 | 月            | month[index - 1]   |   month[index]    |   month[index + 1]  |
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # |2 | 考えられる範囲  |                    |-------------------|                     |
         
     | 
| 
      
 25 
     | 
    
         
            +
                    # |3 | 二十四節気連番  | 0          1       |   2        3      |   4          5      |
         
     | 
| 
      
 26 
     | 
    
         
            +
                    # |4 | 二十四節気大余  | 55         10      |   25       40     |   55         5      |
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #
         
     | 
| 
      
 28 
     | 
    
         
            +
                    attr_reader :all_solar_terms
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    # @return [Cycle::AbstractRemainder] 前月の平朔
         
     | 
| 
      
 31 
     | 
    
         
            +
                    # @note 滅日計算に用いる
         
     | 
| 
      
 32 
     | 
    
         
            +
                    #
         
     | 
| 
      
 33 
     | 
    
         
            +
                    #   月の1日目で前月からの平朔が用いられている
         
     | 
| 
      
 34 
     | 
    
         
            +
                    #
         
     | 
| 
      
 35 
     | 
    
         
            +
                    attr_reader :last_average_remainder
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    #
         
     | 
| 
      
 38 
     | 
    
         
            +
                    # 初期化
         
     | 
| 
      
 39 
     | 
    
         
            +
                    #
         
     | 
| 
      
 40 
     | 
    
         
            +
                    # @param [Array<AbstractSolarTerm>] all_solar_terms 月の全ての二十四節気
         
     | 
| 
      
 41 
     | 
    
         
            +
                    # @param [Cycle::AbstractRemainder] last_average_remainder 前月の平朔
         
     | 
| 
      
 42 
     | 
    
         
            +
                    #
         
     | 
| 
      
 43 
     | 
    
         
            +
                    def initialize(all_solar_terms: [], last_average_remainder: Cycle::AbstractRemainder.new)
         
     | 
| 
      
 44 
     | 
    
         
            +
                      @all_solar_terms = all_solar_terms
         
     | 
| 
      
 45 
     | 
    
         
            +
                      @last_average_remainder = last_average_remainder
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                    #
         
     | 
| 
      
 49 
     | 
    
         
            +
                    # ディープコピー
         
     | 
| 
      
 50 
     | 
    
         
            +
                    #
         
     | 
| 
      
 51 
     | 
    
         
            +
                    # @param [Meta] obj 自身
         
     | 
| 
      
 52 
     | 
    
         
            +
                    #
         
     | 
| 
      
 53 
     | 
    
         
            +
                    def initialize_copy(obj)
         
     | 
| 
      
 54 
     | 
    
         
            +
                      @all_solar_terms = obj.all_solar_terms.clone
         
     | 
| 
      
 55 
     | 
    
         
            +
                      @last_average_remainder = obj.last_average_remainder.clone
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,7 +2,9 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require_relative '../base/gengou'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require_relative './first_day'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative './meta'
         
     | 
| 
       5 
6 
     | 
    
         
             
            require_relative './month_label'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative './meta/meta_collector'
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            # :nodoc:
         
     | 
| 
       8 
10 
     | 
    
         
             
            module Zakuro
         
     | 
| 
         @@ -20,10 +22,14 @@ module Zakuro 
     | 
|
| 
       20 
22 
     | 
    
         
             
                    attr_reader :month_label
         
     | 
| 
       21 
23 
     | 
    
         
             
                    # @return [FirstDay] 月初日(朔日)
         
     | 
| 
       22 
24 
     | 
    
         
             
                    attr_reader :first_day
         
     | 
| 
       23 
     | 
    
         
            -
                    # @return [Array< 
     | 
| 
      
 25 
     | 
    
         
            +
                    # @return [Array<AbstractSolarTerm>] 二十四節気
         
     | 
| 
       24 
26 
     | 
    
         
             
                    attr_reader :solar_terms
         
     | 
| 
       25 
27 
     | 
    
         
             
                    # @return [Base::Gengou] 元号
         
     | 
| 
       26 
28 
     | 
    
         
             
                    attr_reader :gengou
         
     | 
| 
      
 29 
     | 
    
         
            +
                    # @return [Meta] 付加情報
         
     | 
| 
      
 30 
     | 
    
         
            +
                    attr_reader :meta
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    # rubocop:disable Metrics/ParameterLists
         
     | 
| 
       27 
33 
     | 
    
         | 
| 
       28 
34 
     | 
    
         
             
                    #
         
     | 
| 
       29 
35 
     | 
    
         
             
                    # 初期化
         
     | 
| 
         @@ -31,18 +37,23 @@ module Zakuro 
     | 
|
| 
       31 
37 
     | 
    
         
             
                    # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       32 
38 
     | 
    
         
             
                    # @param [MonthLabel] month_label 月表示名
         
     | 
| 
       33 
39 
     | 
    
         
             
                    # @param [FirstDay] first_day 月初日(朔日)
         
     | 
| 
       34 
     | 
    
         
            -
                    # @param [Array< 
     | 
| 
      
 40 
     | 
    
         
            +
                    # @param [Array<AbstractSolarTerm>] solar_terms 二十四節気
         
     | 
| 
       35 
41 
     | 
    
         
             
                    # @param [Base::Gengou] gengou 元号
         
     | 
| 
      
 42 
     | 
    
         
            +
                    # @param [Meta] meta 付加情報
         
     | 
| 
       36 
43 
     | 
    
         
             
                    #
         
     | 
| 
       37 
44 
     | 
    
         
             
                    def initialize(context: Context::Context.new, month_label: MonthLabel.new,
         
     | 
| 
       38 
     | 
    
         
            -
                                   first_day: FirstDay.new, solar_terms: [], gengou: Base::Gengou.new 
     | 
| 
      
 45 
     | 
    
         
            +
                                   first_day: FirstDay.new, solar_terms: [], gengou: Base::Gengou.new,
         
     | 
| 
      
 46 
     | 
    
         
            +
                                   meta: Meta.new)
         
     | 
| 
       39 
47 
     | 
    
         
             
                      @context = context
         
     | 
| 
       40 
48 
     | 
    
         
             
                      @month_label = month_label
         
     | 
| 
       41 
49 
     | 
    
         
             
                      @first_day = first_day
         
     | 
| 
       42 
50 
     | 
    
         
             
                      @solar_terms = solar_terms
         
     | 
| 
       43 
51 
     | 
    
         
             
                      @gengou = gengou
         
     | 
| 
      
 52 
     | 
    
         
            +
                      @meta = meta
         
     | 
| 
       44 
53 
     | 
    
         
             
                    end
         
     | 
| 
       45 
54 
     | 
    
         | 
| 
      
 55 
     | 
    
         
            +
                    # rubocop:enable Metrics/ParameterLists
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
       46 
57 
     | 
    
         
             
                    #
         
     | 
| 
       47 
58 
     | 
    
         
             
                    # 不正か
         
     | 
| 
       48 
59 
     | 
    
         
             
                    #
         
     | 
| 
         @@ -153,7 +164,7 @@ module Zakuro 
     | 
|
| 
       153 
164 
     | 
    
         
             
                    #
         
     | 
| 
       154 
165 
     | 
    
         
             
                    # 中気を返す
         
     | 
| 
       155 
166 
     | 
    
         
             
                    #
         
     | 
| 
       156 
     | 
    
         
            -
                    # @return [ 
     | 
| 
      
 167 
     | 
    
         
            +
                    # @return [Cycle::AbstractSolarTerm] 中気
         
     | 
| 
       157 
168 
     | 
    
         
             
                    #
         
     | 
| 
       158 
169 
     | 
    
         
             
                    def even_term
         
     | 
| 
       159 
170 
     | 
    
         
             
                      solar_terms.each do |term|
         
     | 
| 
         @@ -166,7 +177,7 @@ module Zakuro 
     | 
|
| 
       166 
177 
     | 
    
         
             
                    #
         
     | 
| 
       167 
178 
     | 
    
         
             
                    # 節気を返す
         
     | 
| 
       168 
179 
     | 
    
         
             
                    #
         
     | 
| 
       169 
     | 
    
         
            -
                    # @return [ 
     | 
| 
      
 180 
     | 
    
         
            +
                    # @return [Cycle::AbstractSolarTerm] 節気
         
     | 
| 
       170 
181 
     | 
    
         
             
                    #
         
     | 
| 
       171 
182 
     | 
    
         
             
                    def odd_term
         
     | 
| 
       172 
183 
     | 
    
         
             
                      solar_terms.each do |term|
         
     | 
| 
         @@ -250,6 +261,50 @@ module Zakuro 
     | 
|
| 
       250 
261 
     | 
    
         
             
                      same_by_japan_date?(date: date)
         
     | 
| 
       251 
262 
     | 
    
         
             
                    end
         
     | 
| 
       252 
263 
     | 
    
         | 
| 
      
 264 
     | 
    
         
            +
                    #
         
     | 
| 
      
 265 
     | 
    
         
            +
                    # 大余に対応する二十四節気
         
     | 
| 
      
 266 
     | 
    
         
            +
                    #
         
     | 
| 
      
 267 
     | 
    
         
            +
                    # @param [Integer] day 大余
         
     | 
| 
      
 268 
     | 
    
         
            +
                    #
         
     | 
| 
      
 269 
     | 
    
         
            +
                    # @return [Cycle::AbstractSolarTerm] 二十四節気
         
     | 
| 
      
 270 
     | 
    
         
            +
                    #
         
     | 
| 
      
 271 
     | 
    
         
            +
                    def solar_term_by_day(day:)
         
     | 
| 
      
 272 
     | 
    
         
            +
                      # TODO: refactor
         
     | 
| 
      
 273 
     | 
    
         
            +
                      target = context.resolver.remainder.new(day: day, minute: 0, second: 0)
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
                      meta.all_solar_terms.each_cons(2) do |current_solar_term, next_solar_term|
         
     | 
| 
      
 276 
     | 
    
         
            +
                        in_range = Tools::RemainderComparer.in_range?(
         
     | 
| 
      
 277 
     | 
    
         
            +
                          target: target, start: current_solar_term.remainder, last: next_solar_term.remainder
         
     | 
| 
      
 278 
     | 
    
         
            +
                        )
         
     | 
| 
      
 279 
     | 
    
         
            +
                        return current_solar_term if in_range
         
     | 
| 
      
 280 
     | 
    
         
            +
                      end
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
                      last_solar_term = meta.all_solar_terms[-1]
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
                      empty_solar_term = context.resolver.solar_term.new
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                      return empty_solar_term unless last_solar_term
         
     | 
| 
      
 287 
     | 
    
         
            +
                      # NOTE: 大余20を上限として範囲チェックする
         
     | 
| 
      
 288 
     | 
    
         
            +
                      if Tools::RemainderComparer.in_limit?(target: target, start: last_solar_term.remainder,
         
     | 
| 
      
 289 
     | 
    
         
            +
                                                            limit: 20)
         
     | 
| 
      
 290 
     | 
    
         
            +
                        return last_solar_term
         
     | 
| 
      
 291 
     | 
    
         
            +
                      end
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
                      empty_solar_term
         
     | 
| 
      
 294 
     | 
    
         
            +
                    end
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
                    #
         
     | 
| 
      
 297 
     | 
    
         
            +
                    # メタ情報を再設定する
         
     | 
| 
      
 298 
     | 
    
         
            +
                    #
         
     | 
| 
      
 299 
     | 
    
         
            +
                    # @param [Month] last 前月
         
     | 
| 
      
 300 
     | 
    
         
            +
                    #
         
     | 
| 
      
 301 
     | 
    
         
            +
                    def reset_meta(last: Month.new)
         
     | 
| 
      
 302 
     | 
    
         
            +
                      @meta = MetaCollector.get(
         
     | 
| 
      
 303 
     | 
    
         
            +
                        before_month: last,
         
     | 
| 
      
 304 
     | 
    
         
            +
                        current_month: self
         
     | 
| 
      
 305 
     | 
    
         
            +
                      )
         
     | 
| 
      
 306 
     | 
    
         
            +
                    end
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
       253 
308 
     | 
    
         
             
                    private
         
     | 
| 
       254 
309 
     | 
    
         | 
| 
       255 
310 
     | 
    
         
             
                    #
         
     | 
| 
         @@ -33,12 +33,13 @@ module Zakuro 
     | 
|
| 
       33 
33 
     | 
    
         
             
                    # @param [FirstDay] first_day 月初日(朔日)
         
     | 
| 
       34 
34 
     | 
    
         
             
                    # @param [Array<SolarTerm>] solar_terms 二十四節気
         
     | 
| 
       35 
35 
     | 
    
         
             
                    # @param [Operation::MonthHistory] history 変更履歴(月)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    # @param [Meta] meta 付加情報
         
     | 
| 
       36 
37 
     | 
    
         
             
                    #
         
     | 
| 
       37 
38 
     | 
    
         
             
                    def initialize(context:, operated_solar_term:, month_label: MonthLabel.new,
         
     | 
| 
       38 
39 
     | 
    
         
             
                                   first_day: FirstDay.new, solar_terms: [], gengou: Base::Gengou.new,
         
     | 
| 
       39 
     | 
    
         
            -
                                   history: Operation::MonthHistory.new)
         
     | 
| 
      
 40 
     | 
    
         
            +
                                   history: Operation::MonthHistory.new, meta: Meta.new)
         
     | 
| 
       40 
41 
     | 
    
         
             
                      super(context: context, month_label: month_label, first_day: first_day,
         
     | 
| 
       41 
     | 
    
         
            -
                            solar_terms: solar_terms, gengou: gengou)
         
     | 
| 
      
 42 
     | 
    
         
            +
                            solar_terms: solar_terms, gengou: gengou, meta: meta)
         
     | 
| 
       42 
43 
     | 
    
         
             
                      @history = history
         
     | 
| 
       43 
44 
     | 
    
         
             
                      @operated_solar_term = operated_solar_term
         
     | 
| 
       44 
45 
     | 
    
         
             
                      @moved = false
         
     | 
| 
         @@ -101,7 +102,9 @@ module Zakuro 
     | 
|
| 
       101 
102 
     | 
    
         | 
| 
       102 
103 
     | 
    
         
             
                      @first_day = FirstDay.new(
         
     | 
| 
       103 
104 
     | 
    
         
             
                        western_date: rewrite_western_date(days: days),
         
     | 
| 
       104 
     | 
    
         
            -
                        remainder: rewrite_remainder(days: days)
         
     | 
| 
      
 105 
     | 
    
         
            +
                        remainder: rewrite_remainder(days: days),
         
     | 
| 
      
 106 
     | 
    
         
            +
                        # NOTE: 『日本暦日便覧』では滅日を計算値で求めている。運用値への書き換えは実施しない
         
     | 
| 
      
 107 
     | 
    
         
            +
                        average_remainder: first_day.average_remainder.clone
         
     | 
| 
       105 
108 
     | 
    
         
             
                      )
         
     | 
| 
       106 
109 
     | 
    
         
             
                    end
         
     | 
| 
       107 
110 
     | 
    
         | 
| 
         @@ -24,8 +24,8 @@ module Zakuro 
     | 
|
| 
       24 
24 
     | 
    
         
             
                      attr_reader :limit
         
     | 
| 
       25 
25 
     | 
    
         
             
                      # @return [Integer] 年
         
     | 
| 
       26 
26 
     | 
    
         
             
                      attr_reader :year
         
     | 
| 
       27 
     | 
    
         
            -
                      # @return [ 
     | 
| 
       28 
     | 
    
         
            -
                      attr_reader : 
     | 
| 
      
 27 
     | 
    
         
            +
                      # @return [Cycle::AbstractSolarTerm] 二十四節気
         
     | 
| 
      
 28 
     | 
    
         
            +
                      attr_reader :solar_term
         
     | 
| 
       29 
29 
     | 
    
         
             
                      # @return [Class] 没余クラス
         
     | 
| 
       30 
30 
     | 
    
         
             
                      attr_reader :remainder_class
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
         @@ -33,16 +33,16 @@ module Zakuro 
     | 
|
| 
       33 
33 
     | 
    
         
             
                      # 初期化
         
     | 
| 
       34 
34 
     | 
    
         
             
                      #
         
     | 
| 
       35 
35 
     | 
    
         
             
                      # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       36 
     | 
    
         
            -
                      # @param [ 
     | 
| 
      
 36 
     | 
    
         
            +
                      # @param [Cycle::AbstractSolarTerm] solar_term 二十四節気
         
     | 
| 
       37 
37 
     | 
    
         
             
                      #
         
     | 
| 
       38 
     | 
    
         
            -
                      def initialize(context:,  
     | 
| 
      
 38 
     | 
    
         
            +
                      def initialize(context:, solar_term:)
         
     | 
| 
       39 
39 
     | 
    
         
             
                        parameter = context.resolver.dropped_date_parameter.new
         
     | 
| 
       40 
40 
     | 
    
         
             
                        @context = context
         
     | 
| 
       41 
41 
     | 
    
         
             
                        @valid = parameter.valid
         
     | 
| 
       42 
42 
     | 
    
         
             
                        @limit = parameter.limit
         
     | 
| 
       43 
43 
     | 
    
         
             
                        @year = parameter.year
         
     | 
| 
       44 
44 
     | 
    
         
             
                        @remainder_class = parameter.remainder_class
         
     | 
| 
       45 
     | 
    
         
            -
                        @ 
     | 
| 
      
 45 
     | 
    
         
            +
                        @solar_term = solar_term
         
     | 
| 
       46 
46 
     | 
    
         
             
                      end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                      #
         
     | 
| 
         @@ -73,36 +73,25 @@ module Zakuro 
     | 
|
| 
       73 
73 
     | 
    
         
             
                      def get
         
     | 
| 
       74 
74 
     | 
    
         
             
                        # 1. 二十四節気の大余小余を取り出す
         
     | 
| 
       75 
75 
     | 
    
         
             
                        remainder = solar_term_remainder
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                        # p "remainder: #{remainder.format(form: '%d-%d.%.5f')}"
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
       76 
79 
     | 
    
         
             
                        # 2. 小余360、秒45(360/8)で乗算する
         
     | 
| 
       77 
80 
     | 
    
         
             
                        total = multiple_ideal_year(remainder: remainder)
         
     | 
| 
      
 81 
     | 
    
         
            +
                        # p "total: #{total}"
         
     | 
| 
       78 
82 
     | 
    
         
             
                        # 3. 上記2と章歳(3068055)の差を求める
         
     | 
| 
       79 
83 
     | 
    
         
             
                        diff = (year - total).abs
         
     | 
| 
      
 84 
     | 
    
         
            +
                        # p "year: #{year}"
         
     | 
| 
      
 85 
     | 
    
         
            +
                        # p "diff: #{diff}"
         
     | 
| 
       80 
86 
     | 
    
         
             
                        # 4. 上記3を通余で徐算する
         
     | 
| 
       81 
87 
     | 
    
         
             
                        result = remainder_class.new(total: diff)
         
     | 
| 
      
 88 
     | 
    
         
            +
                        # p "result: #{result.format(form: '%d-%d.%.5f')}"
         
     | 
| 
       82 
89 
     | 
    
         
             
                        # 5. 上記4の商と上記1の大余が没日大余、余りが小余(没余)
         
     | 
| 
       83 
90 
     | 
    
         
             
                        day = remainder_class.new(day: remainder.day, minute: 0, second: 0)
         
     | 
| 
       84 
91 
     | 
    
         | 
| 
       85 
92 
     | 
    
         
             
                        day.add(result)
         
     | 
| 
       86 
93 
     | 
    
         
             
                      end
         
     | 
| 
       87 
94 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
                      #
         
     | 
| 
       89 
     | 
    
         
            -
                      # 該当の二十四節気を取得する
         
     | 
| 
       90 
     | 
    
         
            -
                      #
         
     | 
| 
       91 
     | 
    
         
            -
                      # @return [Cycle::AbstractSolarTerm] 二十四節気
         
     | 
| 
       92 
     | 
    
         
            -
                      #
         
     | 
| 
       93 
     | 
    
         
            -
                      def solar_term
         
     | 
| 
       94 
     | 
    
         
            -
                        solar_terms.each do |solar_term|
         
     | 
| 
       95 
     | 
    
         
            -
                          remainder = solar_term.remainder.clone
         
     | 
| 
       96 
     | 
    
         
            -
                          minute_later = remainder.class.new(
         
     | 
| 
       97 
     | 
    
         
            -
                            day: 0, minute: remainder.minute, second: remainder.second
         
     | 
| 
       98 
     | 
    
         
            -
                          )
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                          return solar_term if minute_later >= limit
         
     | 
| 
       101 
     | 
    
         
            -
                        end
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                        context.resolver.solar_term.new
         
     | 
| 
       104 
     | 
    
         
            -
                      end
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
95 
     | 
    
         
             
                      private
         
     | 
| 
       107 
96 
     | 
    
         | 
| 
       108 
97 
     | 
    
         
             
                      #
         
     | 
| 
         @@ -72,10 +72,17 @@ module Zakuro 
     | 
|
| 
       72 
72 
     | 
    
         
             
                      #
         
     | 
| 
       73 
73 
     | 
    
         
             
                      def get
         
     | 
| 
       74 
74 
     | 
    
         
             
                        # 経朔の小余 * 30
         
     | 
| 
       75 
     | 
    
         
            -
                        minute = remainder_class.new( 
     | 
| 
      
 75 
     | 
    
         
            +
                        minute = remainder_class.new(
         
     | 
| 
      
 76 
     | 
    
         
            +
                          day: 0, minute: IDEAL_MONTH * average_remainder.minute, second: 0
         
     | 
| 
      
 77 
     | 
    
         
            +
                        )
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
       76 
79 
     | 
    
         
             
                        day = remainder_class.new(day: average_remainder.day, minute: 0, second: 0)
         
     | 
| 
       77 
80 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                        minute.add(day)
         
     | 
| 
      
 81 
     | 
    
         
            +
                        minute.add!(day)
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                        # p "location.minute: #{minute.format}"
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                        minute
         
     | 
| 
       79 
86 
     | 
    
         
             
                      end
         
     | 
| 
       80 
87 
     | 
    
         
             
                    end
         
     | 
| 
       81 
88 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -20,8 +20,6 @@ module Zakuro 
     | 
|
| 
       20 
20 
     | 
    
         
             
              module Calculation
         
     | 
| 
       21 
21 
     | 
    
         
             
                # :nodoc:
         
     | 
| 
       22 
22 
     | 
    
         
             
                module Range
         
     | 
| 
       23 
     | 
    
         
            -
                  # :reek:TooManyInstanceVariables { max_instance_variables: 6 }
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
23 
     | 
    
         
             
                  #
         
     | 
| 
       26 
24 
     | 
    
         
             
                  # FullRange 完全範囲
         
     | 
| 
       27 
25 
     | 
    
         
             
                  #   ある日からある日の範囲を計算可能な年月範囲
         
     | 
| 
         @@ -89,6 +87,8 @@ module Zakuro 
     | 
|
| 
       89 
87 
     | 
    
         | 
| 
       90 
88 
     | 
    
         
             
                      Transfer::GengouScroller.set(scroll: scroll, years: years)
         
     | 
| 
       91 
89 
     | 
    
         | 
| 
      
 90 
     | 
    
         
            +
                      reset_meta(years: years)
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
       92 
92 
     | 
    
         
             
                      years
         
     | 
| 
       93 
93 
     | 
    
         
             
                    end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
         @@ -104,6 +104,7 @@ module Zakuro 
     | 
|
| 
       104 
104 
     | 
    
         
             
                      last_year = scroll.western_last_year
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
       106 
106 
     | 
    
         
             
                      # TODO: context にデフォルト暦名が設定されている場合は使用しない
         
     | 
| 
      
 107 
     | 
    
         
            +
                      #  現在は暦ごとの元号情報がないため使用できない
         
     | 
| 
       107 
108 
     | 
    
         
             
                      versions = Version.get(start_year: start_year, last_year: last_year)
         
     | 
| 
       108 
109 
     | 
    
         | 
| 
       109 
110 
     | 
    
         
             
                      collect_version_ranges(versions: versions, start_year: start_year, last_year: last_year)
         
     | 
| 
         @@ -181,6 +182,22 @@ module Zakuro 
     | 
|
| 
       181 
182 
     | 
    
         | 
| 
       182 
183 
     | 
    
         
             
                      result
         
     | 
| 
       183 
184 
     | 
    
         
             
                    end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                    #
         
     | 
| 
      
 187 
     | 
    
         
            +
                    # メタ情報を更新する
         
     | 
| 
      
 188 
     | 
    
         
            +
                    #
         
     | 
| 
      
 189 
     | 
    
         
            +
                    # @param [Array<Base::Year>] years 完全範囲
         
     | 
| 
      
 190 
     | 
    
         
            +
                    #
         
     | 
| 
      
 191 
     | 
    
         
            +
                    def reset_meta(years: [])
         
     | 
| 
      
 192 
     | 
    
         
            +
                      months = []
         
     | 
| 
      
 193 
     | 
    
         
            +
                      years.each do |year|
         
     | 
| 
      
 194 
     | 
    
         
            +
                        months |= year.months
         
     | 
| 
      
 195 
     | 
    
         
            +
                      end
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                      months.each_cons(2) do |last, current|
         
     | 
| 
      
 198 
     | 
    
         
            +
                        current.reset_meta(last: last)
         
     | 
| 
      
 199 
     | 
    
         
            +
                      end
         
     | 
| 
      
 200 
     | 
    
         
            +
                    end
         
     | 
| 
       184 
201 
     | 
    
         
             
                  end
         
     | 
| 
       185 
202 
     | 
    
         
             
                end
         
     | 
| 
       186 
203 
     | 
    
         
             
              end
         
     | 
| 
         @@ -53,6 +53,8 @@ module Zakuro 
     | 
|
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
                      Transfer::GengouScroller.set(scroll: @scroll, years: operated_years)
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
      
 56 
     | 
    
         
            +
                      self.class.reset_meta(years: operated_years)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       56 
58 
     | 
    
         
             
                      operated_years
         
     | 
| 
       57 
59 
     | 
    
         
             
                    end
         
     | 
| 
       58 
60 
     | 
    
         | 
| 
         @@ -172,20 +174,36 @@ module Zakuro 
     | 
|
| 
       172 
174 
     | 
    
         
             
                      # @param [Operation::MonthHistory] history 変更履歴
         
     | 
| 
       173 
175 
     | 
    
         
             
                      # @param [OperatedSolarTerm] operated_solar_term 運用時二十四節気
         
     | 
| 
       174 
176 
     | 
    
         
             
                      #
         
     | 
| 
       175 
     | 
    
         
            -
                      # @return [Month] 月(運用結果)
         
     | 
| 
      
 177 
     | 
    
         
            +
                      # @return [Monthly::Month] 月(運用結果)
         
     | 
| 
       176 
178 
     | 
    
         
             
                      #
         
     | 
| 
       177 
179 
     | 
    
         
             
                      def rewrite_month(context:, month:, history:, operated_solar_term:)
         
     | 
| 
       178 
180 
     | 
    
         
             
                        operated_month = Monthly::OperatedMonth.new(
         
     | 
| 
       179 
181 
     | 
    
         
             
                          context: context,
         
     | 
| 
       180 
182 
     | 
    
         
             
                          month_label: month.month_label, first_day: month.first_day,
         
     | 
| 
       181 
183 
     | 
    
         
             
                          solar_terms: month.solar_terms, history: history, gengou: month.gengou,
         
     | 
| 
       182 
     | 
    
         
            -
                          operated_solar_term: operated_solar_term
         
     | 
| 
      
 184 
     | 
    
         
            +
                          operated_solar_term: operated_solar_term, meta: month.meta
         
     | 
| 
       183 
185 
     | 
    
         
             
                        )
         
     | 
| 
       184 
186 
     | 
    
         | 
| 
       185 
187 
     | 
    
         
             
                        operated_month.rewrite unless history.invalid?
         
     | 
| 
       186 
188 
     | 
    
         | 
| 
       187 
189 
     | 
    
         
             
                        operated_month
         
     | 
| 
       188 
190 
     | 
    
         
             
                      end
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                      #
         
     | 
| 
      
 193 
     | 
    
         
            +
                      # メタ情報を更新する
         
     | 
| 
      
 194 
     | 
    
         
            +
                      #
         
     | 
| 
      
 195 
     | 
    
         
            +
                      # @param [Array<Base::Year>] years 完全範囲
         
     | 
| 
      
 196 
     | 
    
         
            +
                      #
         
     | 
| 
      
 197 
     | 
    
         
            +
                      def reset_meta(years: [])
         
     | 
| 
      
 198 
     | 
    
         
            +
                        months = []
         
     | 
| 
      
 199 
     | 
    
         
            +
                        years.each do |year|
         
     | 
| 
      
 200 
     | 
    
         
            +
                          months |= year.months
         
     | 
| 
      
 201 
     | 
    
         
            +
                        end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                        months.each_cons(2) do |last, current|
         
     | 
| 
      
 204 
     | 
    
         
            +
                          current.reset_meta(last: last)
         
     | 
| 
      
 205 
     | 
    
         
            +
                        end
         
     | 
| 
      
 206 
     | 
    
         
            +
                      end
         
     | 
| 
       189 
207 
     | 
    
         
             
                    end
         
     | 
| 
       190 
208 
     | 
    
         
             
                  end
         
     | 
| 
       191 
209 
     | 
    
         
             
                end
         
     | 
| 
         @@ -22,7 +22,9 @@ module Zakuro 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    #
         
     | 
| 
       23 
23 
     | 
    
         
             
                    def initialize(context:,
         
     | 
| 
       24 
24 
     | 
    
         
             
                                   start_date: Western::Calendar.new, last_date: Western::Calendar.new)
         
     | 
| 
       25 
     | 
    
         
            -
                      scroll = Gengou::DatedScroll.new( 
     | 
| 
      
 25 
     | 
    
         
            +
                      scroll = Gengou::DatedScroll.new(
         
     | 
| 
      
 26 
     | 
    
         
            +
                        start_date: start_date, last_date: last_date, operated: false
         
     | 
| 
      
 27 
     | 
    
         
            +
                      )
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
29 
     | 
    
         
             
                      super(context: context, scroll: scroll, start_date: start_date, last_date: last_date)
         
     | 
| 
       28 
30 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -24,7 +24,9 @@ module Zakuro 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    #
         
     | 
| 
       25 
25 
     | 
    
         
             
                    def initialize(context:, start_date: Western::Calendar.new,
         
     | 
| 
       26 
26 
     | 
    
         
             
                                   last_date: Western::Calendar.new, years: [])
         
     | 
| 
       27 
     | 
    
         
            -
                      scroll = Gengou::DatedScroll.new( 
     | 
| 
      
 27 
     | 
    
         
            +
                      scroll = Gengou::DatedScroll.new(
         
     | 
| 
      
 28 
     | 
    
         
            +
                        start_date: start_date, last_date: last_date, operated: true
         
     | 
| 
      
 29 
     | 
    
         
            +
                      )
         
     | 
| 
       28 
30 
     | 
    
         
             
                      super(context: context, scroll: scroll, years: years)
         
     | 
| 
       29 
31 
     | 
    
         
             
                    end
         
     | 
| 
       30 
32 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -24,7 +24,9 @@ module Zakuro 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    # @param [String] last_name 終了元号名
         
     | 
| 
       25 
25 
     | 
    
         
             
                    #
         
     | 
| 
       26 
26 
     | 
    
         
             
                    def initialize(context:, start_name: INVALID_NAME, last_name: INVALID_NAME)
         
     | 
| 
       27 
     | 
    
         
            -
                      scroll = Gengou::NamedScroll.new( 
     | 
| 
      
 27 
     | 
    
         
            +
                      scroll = Gengou::NamedScroll.new(
         
     | 
| 
      
 28 
     | 
    
         
            +
                        start_name: start_name, last_name: last_name, operated: false
         
     | 
| 
      
 29 
     | 
    
         
            +
                      )
         
     | 
| 
       28 
30 
     | 
    
         
             
                      range = scroll.range
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
       30 
32 
     | 
    
         
             
                      super(
         
     | 
| 
         @@ -26,7 +26,9 @@ module Zakuro 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    # @param [Array<Year>] years 年データ(完全範囲)
         
     | 
| 
       27 
27 
     | 
    
         
             
                    #
         
     | 
| 
       28 
28 
     | 
    
         
             
                    def initialize(context:, start_name: INVALID_NAME, last_name: INVALID_NAME, years: [])
         
     | 
| 
       29 
     | 
    
         
            -
                      scroll = Gengou::NamedScroll.new( 
     | 
| 
      
 29 
     | 
    
         
            +
                      scroll = Gengou::NamedScroll.new(
         
     | 
| 
      
 30 
     | 
    
         
            +
                        start_name: start_name, last_name: last_name, operated: true
         
     | 
| 
      
 31 
     | 
    
         
            +
                      )
         
     | 
| 
       30 
32 
     | 
    
         | 
| 
       31 
33 
     | 
    
         
             
                      super(context: context, scroll: scroll, years: years)
         
     | 
| 
       32 
34 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -21,12 +21,13 @@ module Zakuro 
     | 
|
| 
       21 
21 
     | 
    
         
             
                        # 年間範囲内の年データの開始月を変更する
         
     | 
| 
       22 
22 
     | 
    
         
             
                        #
         
     | 
| 
       23 
23 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       24 
     | 
    
         
            -
                        # @param [Array< 
     | 
| 
      
 24 
     | 
    
         
            +
                        # @param [Array<Array<Monthly::Month>>] annual_ranges 年データ(冬至基準)
         
     | 
| 
       25 
25 
     | 
    
         
             
                        #
         
     | 
| 
       26 
26 
     | 
    
         
             
                        # @return [Array<Base::Year>] 年データ(元旦基準)
         
     | 
| 
       27 
27 
     | 
    
         
             
                        #
         
     | 
| 
       28 
28 
     | 
    
         
             
                        def get(context:, annual_ranges:)
         
     | 
| 
       29 
29 
     | 
    
         
             
                          categorize(context: context, annual_ranges: annual_ranges)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       30 
31 
     | 
    
         
             
                          rearranged_years(context: context, annual_ranges: annual_ranges)
         
     | 
| 
       31 
32 
     | 
    
         
             
                        end
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
         @@ -36,7 +37,7 @@ module Zakuro 
     | 
|
| 
       36 
37 
     | 
    
         
             
                        # 年間範囲内の年データの開始月を変更する
         
     | 
| 
       37 
38 
     | 
    
         
             
                        #
         
     | 
| 
       38 
39 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       39 
     | 
    
         
            -
                        # @param [Array< 
     | 
| 
      
 40 
     | 
    
         
            +
                        # @param [Array<Array<Monthly::Month>>] annual_ranges 年データ(冬至基準)
         
     | 
| 
       40 
41 
     | 
    
         
             
                        #
         
     | 
| 
       41 
42 
     | 
    
         
             
                        # @return [Array<Base::Year>] 年データ(元旦基準)
         
     | 
| 
       42 
43 
     | 
    
         
             
                        #
         
     | 
| 
         @@ -57,7 +58,7 @@ module Zakuro 
     | 
|
| 
       57 
58 
     | 
    
         
             
                        # 年間範囲を昨年/今年で分類する
         
     | 
| 
       58 
59 
     | 
    
         
             
                        #
         
     | 
| 
       59 
60 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       60 
     | 
    
         
            -
                        # @param [Array< 
     | 
| 
      
 61 
     | 
    
         
            +
                        # @param [Array<Array<Monthly::Month>>] annual_range 1年データ
         
     | 
| 
       61 
62 
     | 
    
         
             
                        #
         
     | 
| 
       62 
63 
     | 
    
         
             
                        def categorize(context:, annual_ranges:)
         
     | 
| 
       63 
64 
     | 
    
         
             
                          annual_ranges.each do |annual_range|
         
     | 
| 
         @@ -69,7 +70,7 @@ module Zakuro 
     | 
|
| 
       69 
70 
     | 
    
         
             
                        # 各月を昨年/今年で分類する
         
     | 
| 
       70 
71 
     | 
    
         
             
                        #
         
     | 
| 
       71 
72 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       72 
     | 
    
         
            -
                        # @param [Array<Month>] annual_range 1年データ
         
     | 
| 
      
 73 
     | 
    
         
            +
                        # @param [Array<Monthly::Month>] annual_range 1年データ
         
     | 
| 
       73 
74 
     | 
    
         
             
                        #
         
     | 
| 
       74 
75 
     | 
    
         
             
                        def categorize_year(context:, annual_range:)
         
     | 
| 
       75 
76 
     | 
    
         
             
                          is_last_year = true
         
     | 
| 
         @@ -80,7 +81,8 @@ module Zakuro 
     | 
|
| 
       80 
81 
     | 
    
         
             
                              context: context,
         
     | 
| 
       81 
82 
     | 
    
         
             
                              month_label: month.month_label, first_day: month.first_day,
         
     | 
| 
       82 
83 
     | 
    
         
             
                              solar_terms: month.solar_terms, phase_index: month.phase_index,
         
     | 
| 
       83 
     | 
    
         
            -
                              is_last_year: is_last_year
         
     | 
| 
      
 84 
     | 
    
         
            +
                              is_last_year: is_last_year,
         
     | 
| 
      
 85 
     | 
    
         
            +
                              meta: month.meta
         
     | 
| 
       84 
86 
     | 
    
         
             
                            )
         
     | 
| 
       85 
87 
     | 
    
         
             
                          end
         
     | 
| 
       86 
88 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -89,7 +91,7 @@ module Zakuro 
     | 
|
| 
       89 
91 
     | 
    
         
             
                        # 年データの開始月を変更する
         
     | 
| 
       90 
92 
     | 
    
         
             
                        #
         
     | 
| 
       91 
93 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       92 
     | 
    
         
            -
                        # @param [Array< 
     | 
| 
      
 94 
     | 
    
         
            +
                        # @param [Array<Array<Monthly::Month>>] annual_ranges 年データ(冬至基準)
         
     | 
| 
       93 
95 
     | 
    
         
             
                        # @param [Integer] index 対象年の要素番号
         
     | 
| 
       94 
96 
     | 
    
         
             
                        #
         
     | 
| 
       95 
97 
     | 
    
         
             
                        # @return [Base::Year] 年データ(元旦基準)
         
     | 
| 
         @@ -108,7 +110,7 @@ module Zakuro 
     | 
|
| 
       108 
110 
     | 
    
         
             
                        # 当年データを生成する
         
     | 
| 
       109 
111 
     | 
    
         
             
                        #
         
     | 
| 
       110 
112 
     | 
    
         
             
                        # @param [Context::Context] context 暦コンテキスト
         
     | 
| 
       111 
     | 
    
         
            -
                        # @param [Array<Month>] annual_range 1年データ
         
     | 
| 
      
 113 
     | 
    
         
            +
                        # @param [Array<Monthly::Month>] annual_range 1年データ
         
     | 
| 
       112 
114 
     | 
    
         
             
                        #
         
     | 
| 
       113 
115 
     | 
    
         
             
                        # @return [Base::Year] 当年月ありの対象年
         
     | 
| 
       114 
116 
     | 
    
         
             
                        #
         
     | 
| 
         @@ -126,7 +128,7 @@ module Zakuro 
     | 
|
| 
       126 
128 
     | 
    
         
             
                        #
         
     | 
| 
       127 
129 
     | 
    
         
             
                        # 昨年データを生成する
         
     | 
| 
       128 
130 
     | 
    
         
             
                        #
         
     | 
| 
       129 
     | 
    
         
            -
                        # @param [Array<Month>] annual_range 1年データ
         
     | 
| 
      
 131 
     | 
    
         
            +
                        # @param [Array<Monthly::Month>] annual_range 1年データ
         
     | 
| 
       130 
132 
     | 
    
         
             
                        # @param [Base::Year] year 対象年
         
     | 
| 
       131 
133 
     | 
    
         
             
                        #
         
     | 
| 
       132 
134 
     | 
    
         
             
                        # @return [Base::Year] 昨年月ありの対象年
         
     |