zakuro 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zakuro/calculation/base/multi_gengou.rb +101 -0
  3. data/lib/zakuro/calculation/base/multi_gengou_roller.rb +218 -0
  4. data/lib/zakuro/calculation/base/year.rb +107 -0
  5. data/lib/zakuro/calculation/cycle/abstract_remainder.rb +471 -0
  6. data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +173 -0
  7. data/lib/zakuro/calculation/cycle/zodiac.rb +106 -0
  8. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +169 -0
  9. data/lib/zakuro/calculation/monthly/first_day.rb +45 -0
  10. data/lib/zakuro/calculation/monthly/initialized_month.rb +125 -0
  11. data/lib/zakuro/calculation/monthly/month.rb +187 -0
  12. data/lib/zakuro/calculation/monthly/month_label.rb +88 -0
  13. data/lib/zakuro/calculation/monthly/operated_month.rb +209 -0
  14. data/lib/zakuro/calculation/range/full_range.rb +210 -0
  15. data/lib/zakuro/calculation/range/medieval_annual_range.rb +105 -0
  16. data/lib/zakuro/calculation/range/operated_range.rb +144 -0
  17. data/lib/zakuro/calculation/range/operated_solar_terms.rb +201 -0
  18. data/lib/zakuro/calculation/range/transfer/western_date_allocation.rb +82 -0
  19. data/lib/zakuro/calculation/range/transfer/year_boundary.rb +146 -0
  20. data/lib/zakuro/calculation/specifier/single_day.rb +109 -0
  21. data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +76 -0
  22. data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +52 -0
  23. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +117 -0
  24. data/lib/zakuro/calculation/stella/solar/abstract_location.rb +187 -0
  25. data/lib/zakuro/calculation/stella/solar/choukei_value.rb +136 -0
  26. data/lib/zakuro/calculation/summary/single.rb +129 -0
  27. data/lib/zakuro/calculation/type/old_float.rb +69 -0
  28. data/lib/zakuro/merchant.rb +2 -2
  29. data/lib/zakuro/operation/month/parser.rb +1 -1
  30. data/lib/zakuro/operation/month/type.rb +5 -10
  31. data/lib/zakuro/output/error.rb +7 -6
  32. data/lib/zakuro/output/logger.rb +50 -49
  33. data/lib/zakuro/output/response.rb +145 -144
  34. data/lib/zakuro/tools/typeof.rb +2 -2
  35. data/lib/zakuro/version.rb +1 -1
  36. data/lib/zakuro/version/abstract_version.rb +1 -1
  37. data/lib/zakuro/version/context.rb +23 -0
  38. data/lib/zakuro/version/gihou/const/number.rb +55 -0
  39. data/lib/zakuro/version/gihou/const/remainder.rb +56 -0
  40. data/lib/zakuro/version/gihou/cycle/remainder.rb +61 -0
  41. data/lib/zakuro/version/gihou/cycle/solar_term.rb +34 -0
  42. data/lib/zakuro/version/gihou/gihou.rb +23 -2
  43. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +106 -0
  44. data/lib/zakuro/version/gihou/range/annual_range.rb +39 -0
  45. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +250 -0
  46. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +44 -0
  47. data/lib/zakuro/version/gihou/stella/lunar/location.rb +86 -0
  48. data/lib/zakuro/version/gihou/stella/lunar/value.rb +74 -0
  49. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +34 -0
  50. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +62 -0
  51. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +55 -0
  52. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +93 -0
  53. data/lib/zakuro/version/gihou/stella/solar/average.rb +97 -0
  54. data/lib/zakuro/version/gihou/stella/solar/interval.rb +108 -0
  55. data/lib/zakuro/version/gihou/stella/solar/location.rb +61 -0
  56. data/lib/zakuro/version/gihou/stella/solar/value.rb +36 -0
  57. data/lib/zakuro/version/senmyou/const/number.rb +51 -0
  58. data/lib/zakuro/version/senmyou/const/remainder.rb +49 -0
  59. data/lib/zakuro/version/senmyou/cycle/remainder.rb +61 -0
  60. data/lib/zakuro/version/senmyou/cycle/solar_term.rb +34 -0
  61. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +80 -195
  62. data/lib/zakuro/version/senmyou/range/annual_range.rb +25 -170
  63. data/lib/zakuro/version/senmyou/senmyou.rb +10 -4
  64. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +237 -0
  65. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +44 -0
  66. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +93 -0
  67. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -0
  68. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +34 -0
  69. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +62 -0
  70. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +55 -0
  71. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +93 -0
  72. data/lib/zakuro/version/senmyou/stella/solar/average.rb +97 -0
  73. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +103 -0
  74. data/lib/zakuro/version/senmyou/stella/solar/location.rb +61 -0
  75. data/lib/zakuro/version/senmyou/stella/solar/value.rb +39 -0
  76. data/lib/zakuro/version/version_class_resolver.rb +66 -0
  77. data/lib/zakuro/version_factory.rb +2 -2
  78. metadata +64 -24
  79. data/lib/zakuro/cycle/abstract_remainder.rb +0 -456
  80. data/lib/zakuro/cycle/zodiac.rb +0 -103
  81. data/lib/zakuro/version/senmyou/base/era.rb +0 -83
  82. data/lib/zakuro/version/senmyou/base/multi_gengou.rb +0 -98
  83. data/lib/zakuro/version/senmyou/base/multi_gengou_roller.rb +0 -217
  84. data/lib/zakuro/version/senmyou/base/remainder.rb +0 -60
  85. data/lib/zakuro/version/senmyou/base/solar_term.rb +0 -86
  86. data/lib/zakuro/version/senmyou/base/year.rb +0 -104
  87. data/lib/zakuro/version/senmyou/monthly/first_day.rb +0 -44
  88. data/lib/zakuro/version/senmyou/monthly/initialized_month.rb +0 -48
  89. data/lib/zakuro/version/senmyou/monthly/month.rb +0 -181
  90. data/lib/zakuro/version/senmyou/monthly/month_label.rb +0 -87
  91. data/lib/zakuro/version/senmyou/monthly/operated_month.rb +0 -167
  92. data/lib/zakuro/version/senmyou/range/full_range.rb +0 -324
  93. data/lib/zakuro/version/senmyou/range/operated_range.rb +0 -126
  94. data/lib/zakuro/version/senmyou/range/operated_solar_terms.rb +0 -181
  95. data/lib/zakuro/version/senmyou/specifier/single_day_specifier.rb +0 -102
  96. data/lib/zakuro/version/senmyou/stella/lunar_orbit.rb +0 -332
  97. data/lib/zakuro/version/senmyou/stella/solar_average.rb +0 -214
  98. data/lib/zakuro/version/senmyou/stella/solar_orbit.rb +0 -394
  99. data/lib/zakuro/version/senmyou/stella/winter_solstice.rb +0 -106
  100. data/lib/zakuro/version/senmyou/summary/single.rb +0 -125
@@ -1,103 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nodoc:
4
- module Zakuro
5
- # :nodoc:
6
- module Cycle
7
- #
8
- # Zodiac 十干十二支
9
- #
10
- module Zodiac
11
- # @return [Hash<Integer, String>] 十干十二支
12
- ZODIAC_NAME_PATTERNS = {
13
- 0 => '甲子', # きのえね
14
- 1 => '乙丑', # きのとうし
15
- 2 => '丙寅', # ひのえとら
16
- 3 => '丁卯', # ひのとう
17
- 4 => '戊辰', # つちのえたつ
18
- 5 => '己巳', # つちのとみ
19
- 6 => '庚午', # かのえうま
20
- 7 => '辛未', # かのとひつじ
21
- 8 => '壬申', # みずのえさる
22
- 9 => '癸酉', # みずのととり
23
- 10 => '甲戌', # きのえいぬ
24
- 11 => '乙亥', # きのとい
25
- 12 => '丙子', # ひのえね
26
- 13 => '丁丑', # ひのとうし
27
- 14 => '戊寅', # つちのえとら
28
- 15 => '己卯', # つちのとう
29
- 16 => '庚辰', # かのえたつ
30
- 17 => '辛巳', # かのとみ
31
- 18 => '壬午', # みずのえうま
32
- 19 => '癸未', # みずのとひつじ
33
- 20 => '甲申', # きのえさる
34
- 21 => '乙酉', # きのととり
35
- 22 => '丙戌', # ひのえいぬ
36
- 23 => '丁亥', # ひのとい
37
- 24 => '戊子', # つちのえね
38
- 25 => '己丑', # つちのとうし
39
- 26 => '庚寅', # かのえとら
40
- 27 => '辛卯', # かのとう
41
- 28 => '壬辰', # みずのえたつ
42
- 29 => '癸巳', # みずのとみ
43
- 30 => '甲午', # きのえうま
44
- 31 => '乙未', # きのとひつじ
45
- 32 => '丙申', # ひのえさる
46
- 33 => '丁酉', # ひのととり
47
- 34 => '戊戌', # つちのえいぬ
48
- 35 => '己亥', # つちのとい
49
- 36 => '庚子', # かのえね
50
- 37 => '辛丑', # かのとうし
51
- 38 => '壬寅', # みずのえとら
52
- 39 => '癸卯', # みずのとう
53
- 40 => '甲辰', # きのえたつ
54
- 41 => '乙巳', # きのとみ
55
- 42 => '丙午', # ひのえうま
56
- 43 => '丁未', # ひのとひつじ
57
- 44 => '戊申', # つちのえさる
58
- 45 => '己酉', # つちのととり
59
- 46 => '庚戌', # かのえいぬ
60
- 47 => '辛亥', # かのとい
61
- 48 => '壬子', # みずのえね
62
- 49 => '癸丑', # みずのとうし
63
- 50 => '甲寅', # きのえとら
64
- 51 => '乙卯', # きのとう
65
- 52 => '丙辰', # ひのえたつ
66
- 53 => '丁巳', # ひのとみ
67
- 54 => '戊午', # つちのえうま
68
- 55 => '己未', # つちのとひつじ
69
- 56 => '庚申', # かのえさる
70
- 57 => '辛酉', # かのととり
71
- 58 => '壬戌', # みずのえいぬ
72
- 59 => '癸亥' # みずのとい
73
- }.freeze
74
-
75
- # @return [Integer] 組み合わせ数
76
- LENGTH = ZODIAC_NAME_PATTERNS.length
77
-
78
- #
79
- # 大余を十干十二支に変換する
80
- #
81
- # @param [Integer] day 大余
82
- #
83
- # @return [String] 十干十二支
84
- #
85
- def self.day_name(day:)
86
- index = day % LENGTH
87
-
88
- ZODIAC_NAME_PATTERNS[index]
89
- end
90
-
91
- #
92
- # 西暦年を十干十二支に変換する
93
- #
94
- # @param [Integer] western_year 西暦年
95
- #
96
- # @return [String] 十干十二支
97
- #
98
- def self.year_name(western_year: 0)
99
- ZODIAC_NAME_PATTERNS[(western_year - 4) % LENGTH]
100
- end
101
- end
102
- end
103
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../era/japan/gengou'
4
- require_relative '../../../era/western'
5
- require_relative '../../../cycle/zodiac'
6
-
7
- # :nodoc:
8
- module Zakuro
9
- # :nodoc:
10
- module Senmyou
11
- #
12
- # Era 宣明暦時代
13
- #
14
- module Era
15
- # FIXME: JOUGAN_START_DATE は不要。'貞観' かどうかだけで良い
16
-
17
- # @return [Western::Calendar] 貞観1年1月1日
18
- JOUGAN_START_DATE = Western::Calendar.new(year: 859, month: 2, day: 7)
19
- # @return [Western::Calendar] 貞観4年1月1日
20
- START_DATE = Western::Calendar.new(year: 862, month: 2, day: 3)
21
- # @return [Integer] (貞観)4年
22
- START_GENGOU_YEAR = 4
23
- # @return [Western::Calendar] 貞享2年12月29日
24
- END_DATE = Western::Calendar.new(year: 1686, month: 1, day: 23)
25
-
26
- #
27
- # 元号(1行目)を取得する
28
- #
29
- # @param [Western::Calendar] start_date 開始日
30
- #
31
- # @return [Japan::Gengou] 元号(1行目)
32
- #
33
- def self.first(start_date:)
34
- first_gengou = Japan::GengouResource.first_line(date: start_date)
35
- # 宣明暦の初めの元号であれば、起算年を4年とする
36
- if JOUGAN_START_DATE == first_gengou.start_date
37
- first_gengou = Japan::Gengou.new(
38
- name: first_gengou.name,
39
- start_date: START_DATE,
40
- end_date: first_gengou.end_date,
41
- year: START_GENGOU_YEAR
42
- )
43
- end
44
-
45
- first_gengou
46
- end
47
-
48
- #
49
- # 元号(2行目)を取得する
50
- #
51
- # @param [Western::Calendar] start_date 開始日
52
- #
53
- # @return [Japan::Gengou] 元号(2行目)
54
- #
55
- def self.second(start_date:)
56
- Japan::GengouResource.second_line(date: start_date)
57
- end
58
-
59
- #
60
- # 宣明暦に含まれるかを確認する
61
- #
62
- # @param [Western::Calendar] date 日付
63
- #
64
- # @return [True] 含まれる
65
- # @return [False] 含まれない
66
- #
67
- def self.include?(date:)
68
- (START_DATE <= date && date <= END_DATE)
69
- end
70
-
71
- #
72
- # 十干十二支を引き当てる
73
- #
74
- # @param [String] western_year 西暦年
75
- #
76
- # @return [String] 十干十二支
77
- #
78
- def self.zodiac_name(western_year: 0)
79
- Cycle::Zodiac.year_name(western_year: western_year)
80
- end
81
- end
82
- end
83
- end
@@ -1,98 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../era/japan/gengou'
4
- require_relative '../../../era/western'
5
-
6
- # :nodoc:
7
- module Zakuro
8
- # :nodoc:
9
- module Senmyou
10
- #
11
- # MultiGengou 複数元号
12
- #
13
- class MultiGengou
14
- # @return [Japan::Gengou] 元号(1行目)
15
- attr_reader :first_line
16
- # @return [Japan::Gengou] 元号(2行目)
17
- attr_reader :second_line
18
- # @return [Western::Calendar] 元旦
19
- attr_reader :new_year_date
20
-
21
- def initialize(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new,
22
- new_year_date: Western::Calendar.new)
23
- @first_line = first_line
24
- @second_line = second_line
25
- @new_year_date = new_year_date
26
- end
27
-
28
- # :reek:TooManyStatements { max_statements: 7 }
29
-
30
- #
31
- # 改元する
32
- #
33
- # @param [Japan::Gengou] first_line 元号(1行目)
34
- # @param [Japan::Gengou] second_line 元号(2行目)
35
- #
36
- # @return [MultiGengou] 自身
37
- #
38
- def transfer(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new)
39
- cloned_first_line = first_line.clone
40
- cloned_second_line = second_line.clone
41
-
42
- if integrated?(first_line: cloned_first_line, second_line: cloned_second_line)
43
- @first_line = @second_line.clone
44
- @second_line = cloned_second_line
45
- end
46
-
47
- @first_line = cloned_first_line if @first_line.name != first_line.name
48
- @second_line = cloned_second_line if @second_line.name != second_line.name
49
-
50
- self
51
- end
52
-
53
- #
54
- # 次年にする
55
- #
56
- # @param [Japan::Gengou] first_line 元号(1行目)
57
- # @param [Japan::Gengou] second_line 元号(2行目)
58
- #
59
- # @return [MultiGengou] 自身
60
- #
61
- def next_year
62
- @first_line.next_year
63
- @second_line.next_year
64
-
65
- self
66
- end
67
-
68
- #
69
- # ディープコピー
70
- #
71
- # @param [MultiGengou] obj 自身
72
- #
73
- def initialize_copy(obj)
74
- @first_line = obj.first_line.clone
75
- @second_line = obj.second_line.clone
76
- end
77
-
78
- private
79
-
80
- #
81
- # 複数元号を統一するかどうか
82
- #
83
- # @param [Japan::Gengou] first_line 元号(1行目)
84
- # @param [Japan::Gengou] second_line 元号(2行目)
85
- #
86
- # @return [True] 統一する
87
- # @return [False] 統一しない
88
- #
89
- def integrated?(first_line: Japan::Gengou.new, second_line: Japan::Gengou.new)
90
- return false if @second_line.name != first_line.name
91
-
92
- return false unless second_line.invalid?
93
-
94
- true
95
- end
96
- end
97
- end
98
- end
@@ -1,217 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative './era'
4
- require_relative './multi_gengou'
5
-
6
- require_relative '../../../era/japan/gengou'
7
-
8
- # :nodoc:
9
- module Zakuro
10
- # :nodoc:
11
- module Senmyou
12
- # FIXME: 宣明暦に依存しない共通処理にする
13
-
14
- #
15
- # MultiGengouRoller 改元処理
16
- #
17
- class MultiGengouRoller
18
- # @return [MultiGengou] 複数元号
19
- attr_reader :multi_gengou
20
- # @return [Western::Calendar] 元旦(元号が2つある場合は再過去の日付になる)
21
- attr_reader :oldest_date
22
- # @return [Western::Calendar] 元号内での最未来日(元号が2つある場合は再未来の日付になる)
23
- attr_reader :newest_date
24
- # @return [Western::Calendar] 現在日
25
- attr_reader :current_date
26
-
27
- def initialize(start_date: Era::START_DATE, end_date: Western::Calendar.new)
28
- end_date = start_date if end_date.invalid?
29
-
30
- @oldest_date = MultiGengouRoller.choise_oldest_gengou_date(
31
- first_line: Era.first(start_date: start_date),
32
- second_line: Era.second(start_date: start_date)
33
- )
34
- @current_date = @oldest_date.clone
35
- @newest_date = MultiGengouRoller.choise_newest_gengou_date(
36
- first_line: Era.first(start_date: end_date),
37
- second_line: Era.second(start_date: end_date)
38
- )
39
-
40
- @multi_gengou = MultiGengou.new(
41
- first_line: current_first_line,
42
- second_line: current_second_line,
43
- new_year_date: @oldest_date
44
- )
45
- end
46
-
47
- #
48
- # 現在日付を未来に進める
49
- #
50
- # @param [<Type>] days <description>
51
- #
52
- # @return [<Type>] <description>
53
- #
54
- def next(days: 0)
55
- @current_date += days
56
- end
57
-
58
- #
59
- # 現在日から元号(1行目)を取得する
60
- #
61
- # @return [Japan::Gengou] 元号(1行目)
62
- #
63
- def current_first_line
64
- MultiGengouRoller.first_line(date: @current_date)
65
- end
66
-
67
- #
68
- # 現在日から元号(2行目)を取得する
69
- #
70
- # @return [Japan::Gengou] 元号(2行目)
71
- #
72
- def current_second_line
73
- MultiGengouRoller.second_line(date: @current_date)
74
- end
75
-
76
- #
77
- # 改元する
78
- #
79
- # @return [MultiGengou] 複数元号
80
- #
81
- def transfer
82
- MultiGengouRoller.transfer(multi_gengou: @multi_gengou, date: @current_date)
83
- end
84
-
85
- #
86
- # 次年にする
87
- #
88
- # @return [MultiGengou] 複数元号
89
- #
90
- def next_year
91
- @multi_gengou.next_year
92
- end
93
-
94
- #
95
- # 元号(1行目)を取得する
96
- #
97
- # @return [Japan::Gengou] 元号(1行目)
98
- #
99
- def self.first_line(date: Western::Calender.new)
100
- Era.first(start_date: date)
101
- end
102
-
103
- #
104
- # 元号(2行目)を取得する
105
- #
106
- # @return [Japan::Gengou] 元号(2行目)
107
- #
108
- def self.second_line(date: Western::Calender.new)
109
- Era.second(start_date: date)
110
- end
111
-
112
- #
113
- # 改元する
114
- #
115
- # @param [MultiGengou] multi_gengou 複数元号
116
- # @param [Western::Calendar] date 対象日
117
- #
118
- # @return [MultiGengou] 改元済み複数元号
119
- #
120
- def self.transfer(multi_gengou:, date:)
121
- multi_gengou.transfer(
122
- first_line: first_line(date: date),
123
- second_line: second_line(date: date)
124
- )
125
-
126
- multi_gengou
127
- end
128
-
129
- #
130
- # 現在日からみて直近の未来に対する元号の切替前日を求める
131
- # @note 2つの元号が重複した場合はより過去の日となる
132
- #
133
- # @param [Japan::Gengou] first_line 元号(1行目)
134
- # @param [Japan::Gengou] second_line 元号(2行目)
135
- #
136
- # @return [Western::Calendar] 元号の切替前日
137
- #
138
- def choise_nearest_end_date
139
- condition = lambda do |first_date, second_date|
140
- first_date < second_date ? first_date : second_date
141
- end
142
-
143
- second_line = current_second_line
144
-
145
- MultiGengouRoller.choise_date(condition: condition, second_line: second_line,
146
- first_date: current_first_line.end_date.clone,
147
- second_date: second_line.end_date.clone)
148
- end
149
-
150
- #
151
- # 最過去の元旦を求める
152
- # @note 2つの元号が重複した場合はより過去の日となる
153
- #
154
- # @param [Japan::Gengou] first_line 元号(1行目)
155
- # @param [Japan::Gengou] second_line 元号(2行目)
156
- #
157
- # @return [Western::Calendar] 最過去の元旦
158
- #
159
- def self.choise_oldest_gengou_date(first_line:, second_line:)
160
- condition = lambda do |first_date, second_date|
161
- first_date < second_date ? first_date : second_date
162
- end
163
- choise_date(condition: condition, second_line: second_line,
164
- first_date: first_line.new_year_date.clone,
165
- second_date: second_line.new_year_date.clone)
166
- end
167
-
168
- #
169
- # 元号内での最未来日を求める
170
- # @note 2つの元号が重複した場合はより未来の日となる
171
- #
172
- # @param [Japan::Gengou] first_line 元号(1行目)
173
- # @param [Japan::Gengou] second_line 元号(2行目)
174
- #
175
- # @return [Western::Calendar] 最未来日
176
- #
177
- def self.choise_newest_gengou_date(first_line:, second_line:)
178
- condition = lambda do |first_date, second_date|
179
- first_date > second_date ? first_date : second_date
180
- end
181
- choise_date(condition: condition, second_line: second_line,
182
- first_date: first_line.end_date.clone, second_date: second_line.end_date.clone)
183
- end
184
-
185
- # :reek:LongParameterList {max_params: 4}
186
-
187
- #
188
- # 条件を元に日付を求める
189
- #
190
- # @param [Proc] condition 比較条件
191
- # @param [Japan::Gengou] second_line 元号(2行目)
192
- # @param [Western::Calendar] first_date 比較対象(1行目)
193
- # @param [Western::Calendar] second_date 比較対象(2行目)
194
- #
195
- # @return [Western::Calendar] 比較結果
196
- #
197
- def self.choise_date(condition:, second_line:, first_date:, second_date:)
198
- # first_lineは常に存在する
199
- return first_date if second_line.invalid?
200
-
201
- condition.call(first_date, second_date)
202
- end
203
-
204
- #
205
- # ディープコピー
206
- #
207
- # @param [MultiGengou] obj 自身
208
- #
209
- def initialize_copy(obj)
210
- @oldest_date = obj.oldest_date.clone
211
- @current_date = obj.current_date.clone
212
- @newest_date = obj.newest_date.clone
213
- @multi_gengou = obj.multi_gengou.clone
214
- end
215
- end
216
- end
217
- end