zakuro 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/VERSION +1 -1
- data/lib/zakuro/calculation/base/gengou.rb +5 -5
- data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
- data/lib/zakuro/calculation/base/operated_year.rb +23 -21
- data/lib/zakuro/calculation/base/year.rb +3 -3
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +50 -44
- data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +28 -24
- data/lib/zakuro/calculation/cycle/zodiac.rb +22 -20
- data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +38 -29
- data/lib/zakuro/calculation/era/gengou/internal/connector.rb +4 -4
- data/lib/zakuro/calculation/era/gengou/internal/counter.rb +16 -16
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +74 -72
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +16 -16
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +58 -35
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +3 -3
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +111 -113
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +6 -6
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +7 -9
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +22 -20
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +39 -22
- data/lib/zakuro/calculation/era/version/version.rb +12 -10
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +13 -9
- data/lib/zakuro/calculation/monthly/const.rb +18 -0
- data/lib/zakuro/calculation/monthly/initialized_month.rb +39 -37
- data/lib/zakuro/calculation/monthly/month.rb +15 -15
- data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
- data/lib/zakuro/calculation/monthly/operated_month.rb +36 -85
- data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
- data/lib/zakuro/calculation/range/abstract_full_range.rb +34 -21
- data/lib/zakuro/calculation/range/abstract_operation_range.rb +109 -107
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +64 -63
- data/lib/zakuro/calculation/range/operated_solar_term.rb +220 -0
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +32 -29
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +115 -117
- data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +1 -1
- data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +48 -46
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +31 -26
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +5 -5
- data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
- data/lib/zakuro/calculation/summary/internal/day.rb +21 -19
- data/lib/zakuro/calculation/summary/internal/month.rb +25 -12
- data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
- data/lib/zakuro/calculation/summary/internal/option.rb +66 -50
- data/lib/zakuro/calculation/summary/japan/range.rb +145 -124
- data/lib/zakuro/calculation/summary/japan/single.rb +87 -87
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +54 -52
- data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
- data/lib/zakuro/calculation/summary/western/range.rb +95 -92
- data/lib/zakuro/calculation/summary/western/single.rb +78 -76
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +123 -124
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +60 -58
- data/lib/zakuro/calculation/type/old_float.rb +2 -2
- data/lib/zakuro/condition.rb +121 -111
- data/lib/zakuro/context/context.rb +1 -1
- data/lib/zakuro/context/option.rb +31 -29
- data/lib/zakuro/context/version_class_resolver.rb +26 -24
- data/lib/zakuro/era/japan/calendar.rb +35 -33
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +4 -4
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +117 -118
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +7 -5
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +20 -14
- data/lib/zakuro/era/japan/gengou/alignment.rb +27 -25
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +51 -36
- data/lib/zakuro/era/japan/gengou/resource/type.rb +39 -37
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +34 -32
- data/lib/zakuro/era/japan/gengou.rb +28 -26
- data/lib/zakuro/era/japan/version.rb +18 -16
- data/lib/zakuro/era/western/calendar.rb +102 -90
- data/lib/zakuro/exception/case/preset.rb +2 -2
- data/lib/zakuro/exception/exception.rb +15 -13
- data/lib/zakuro/exception/zakuro_error.rb +1 -1
- data/lib/zakuro/gateway/locale/date.rb +2 -2
- data/lib/zakuro/gateway/locale/range.rb +3 -3
- data/lib/zakuro/gateway/range.rb +1 -1
- data/lib/zakuro/gateway/single.rb +13 -2
- data/lib/zakuro/merchant.rb +1 -1
- data/lib/zakuro/operation/month/parser.rb +252 -251
- data/lib/zakuro/operation/month/type.rb +17 -8
- data/lib/zakuro/operation/month/validator.rb +148 -144
- data/lib/zakuro/operation/operation.rb +38 -36
- data/lib/zakuro/output/response.rb +112 -113
- data/lib/zakuro/result/operation/month/annotation.rb +2 -2
- data/lib/zakuro/result/operation/month/history.rb +2 -2
- data/lib/zakuro/result/operation/month.rb +31 -0
- data/lib/zakuro/result/operation.rb +39 -0
- data/lib/zakuro/result/result.rb +3 -3
- data/lib/zakuro/tools/stringifier.rb +66 -64
- data/lib/zakuro/tools/typeconv.rb +17 -15
- data/lib/zakuro/tools/typeof.rb +15 -13
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
- data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -39
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -49
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/daien/stella/solar/average.rb +53 -51
- data/lib/zakuro/version/daien/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/daien/stella/solar/value.rb +13 -11
- data/lib/zakuro/version/genka/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
- data/lib/zakuro/version/genka/range/annual_range.rb +48 -44
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +30 -28
- data/lib/zakuro/version/genka/stella/origin/january.rb +22 -20
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
- data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -39
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -49
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +24 -22
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/gihou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/gihou/stella/solar/value.rb +13 -11
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +10 -10
- data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -38
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -36
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +13 -11
- metadata +12 -9
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -218
- data/lib/zakuro/result/operation/bundle.rb +0 -44
- data/lib/zakuro/result/operation/month/bundle.rb +0 -36
@@ -80,41 +80,13 @@ module Zakuro
|
|
80
80
|
nil
|
81
81
|
end
|
82
82
|
|
83
|
-
#
|
84
|
-
# 年が不正なしかどうかを確認する
|
85
|
-
#
|
86
|
-
# @param [Integer] year 年
|
87
|
-
#
|
88
|
-
# @return [True] 不正なし
|
89
|
-
# @return [False] 不正
|
90
|
-
#
|
91
|
-
def self.valid_year(year:)
|
92
|
-
return false unless year
|
93
|
-
|
94
|
-
year.is_a?(Integer)
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# 日付が不正なしかどうかを確認する
|
99
|
-
#
|
100
|
-
# @param [Western::Calendar] date 日付
|
101
|
-
#
|
102
|
-
# @return [True] 不正なし
|
103
|
-
# @return [False] 不正
|
104
|
-
#
|
105
|
-
def self.valid_date(date:)
|
106
|
-
return false unless date
|
107
|
-
|
108
|
-
date.is_a?(Western::Calendar)
|
109
|
-
end
|
110
|
-
|
111
83
|
#
|
112
84
|
# 次の元号の開始年から、元号の終了年に変換する
|
113
85
|
#
|
114
86
|
# @param [Integer] next_start_year 次回開始年
|
115
87
|
#
|
116
88
|
def convert_next_start_year_to_last_year(next_start_year:)
|
117
|
-
if
|
89
|
+
if both_start_year.western >= next_start_year
|
118
90
|
@last_year = next_start_year
|
119
91
|
return
|
120
92
|
end
|
@@ -149,7 +121,7 @@ module Zakuro
|
|
149
121
|
# @return [False] 含まれない
|
150
122
|
#
|
151
123
|
def include?(date:)
|
152
|
-
date >=
|
124
|
+
date >= both_start_date.western && date <= last_date
|
153
125
|
end
|
154
126
|
|
155
127
|
#
|
@@ -159,8 +131,8 @@ module Zakuro
|
|
159
131
|
# @return [False] 不正なし
|
160
132
|
#
|
161
133
|
def invalid?
|
162
|
-
|
163
|
-
|
134
|
+
both_start_year.japan == -1 || both_start_year.invalid? ||
|
135
|
+
both_start_date.invalid? || last_date.invalid?
|
164
136
|
end
|
165
137
|
|
166
138
|
#
|
@@ -172,8 +144,38 @@ module Zakuro
|
|
172
144
|
# end
|
173
145
|
|
174
146
|
def to_s
|
175
|
-
"name: #{@name}, both_start_year: #{
|
176
|
-
"both_start_date: #{
|
147
|
+
"name: #{@name}, both_start_year: #{both_start_year.format}, " \
|
148
|
+
"both_start_date: #{both_start_date.format}, last_date: #{last_date.format}"
|
149
|
+
end
|
150
|
+
|
151
|
+
class << self
|
152
|
+
#
|
153
|
+
# 年が不正なしかどうかを確認する
|
154
|
+
#
|
155
|
+
# @param [Integer] year 年
|
156
|
+
#
|
157
|
+
# @return [True] 不正なし
|
158
|
+
# @return [False] 不正
|
159
|
+
#
|
160
|
+
def valid_year(year:)
|
161
|
+
return false unless year
|
162
|
+
|
163
|
+
year.is_a?(Integer)
|
164
|
+
end
|
165
|
+
|
166
|
+
#
|
167
|
+
# 日付が不正なしかどうかを確認する
|
168
|
+
#
|
169
|
+
# @param [Western::Calendar] date 日付
|
170
|
+
#
|
171
|
+
# @return [True] 不正なし
|
172
|
+
# @return [False] 不正
|
173
|
+
#
|
174
|
+
def valid_date(date:)
|
175
|
+
return false unless date
|
176
|
+
|
177
|
+
date.is_a?(Western::Calendar)
|
178
|
+
end
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
@@ -219,7 +221,7 @@ module Zakuro
|
|
219
221
|
# @return [Gengou] 元号
|
220
222
|
#
|
221
223
|
def include_item(date:)
|
222
|
-
|
224
|
+
list.each do |item|
|
223
225
|
return item if item.include?(date: date)
|
224
226
|
end
|
225
227
|
|
@@ -264,7 +266,7 @@ module Zakuro
|
|
264
266
|
# @return [False] 不正なし
|
265
267
|
#
|
266
268
|
def invalid?
|
267
|
-
|
269
|
+
japan == INVALID || western == INVALID
|
268
270
|
end
|
269
271
|
end
|
270
272
|
|
@@ -289,7 +291,7 @@ module Zakuro
|
|
289
291
|
# @return [False] 不正なし
|
290
292
|
#
|
291
293
|
def invalid?
|
292
|
-
|
294
|
+
japan.invalid? || western.invalid?
|
293
295
|
end
|
294
296
|
end
|
295
297
|
end
|
@@ -54,9 +54,9 @@ module Zakuro
|
|
54
54
|
#
|
55
55
|
def validate
|
56
56
|
failed = []
|
57
|
-
failed.push("invalid id. #{
|
57
|
+
failed.push("invalid id. #{id}") unless id?
|
58
58
|
|
59
|
-
failed.push("invalid name. #{
|
59
|
+
failed.push("invalid name. #{name}") unless name?
|
60
60
|
|
61
61
|
failed |= validate_both_last_year
|
62
62
|
|
@@ -73,9 +73,9 @@ module Zakuro
|
|
73
73
|
# @return [False] 正しくない
|
74
74
|
#
|
75
75
|
def id?
|
76
|
-
return false unless
|
76
|
+
return false unless id
|
77
77
|
|
78
|
-
|
78
|
+
id.is_a?(Integer)
|
79
79
|
end
|
80
80
|
|
81
81
|
#
|
@@ -87,7 +87,7 @@ module Zakuro
|
|
87
87
|
def name?
|
88
88
|
return false unless @name
|
89
89
|
|
90
|
-
|
90
|
+
name.is_a?(String)
|
91
91
|
end
|
92
92
|
|
93
93
|
#
|
@@ -96,7 +96,7 @@ module Zakuro
|
|
96
96
|
# @return [Array<String>] 不正メッセージ
|
97
97
|
#
|
98
98
|
def validate_both_last_year
|
99
|
-
Both::Year.new(hash:
|
99
|
+
Both::Year.new(hash: both_last_year).validate
|
100
100
|
end
|
101
101
|
|
102
102
|
#
|
@@ -105,7 +105,7 @@ module Zakuro
|
|
105
105
|
# @return [Array<String>] 不正メッセージ
|
106
106
|
#
|
107
107
|
def validate_both_last_date
|
108
|
-
Both::Date.new(hash:
|
108
|
+
Both::Date.new(hash: both_last_date).validate
|
109
109
|
end
|
110
110
|
|
111
111
|
#
|
@@ -115,9 +115,9 @@ module Zakuro
|
|
115
115
|
# @return [False] 正しくない
|
116
116
|
#
|
117
117
|
def list?
|
118
|
-
return false unless
|
118
|
+
return false unless list
|
119
119
|
|
120
|
-
|
120
|
+
list.is_a?(Array)
|
121
121
|
end
|
122
122
|
|
123
123
|
#
|
@@ -126,7 +126,7 @@ module Zakuro
|
|
126
126
|
# @return [Array<String>] 不正メッセージ
|
127
127
|
#
|
128
128
|
def validate_list
|
129
|
-
return ["invalid list. #{
|
129
|
+
return ["invalid list. #{list.class}"] unless list?
|
130
130
|
|
131
131
|
failed = []
|
132
132
|
list.each_with_index do |li, index|
|
@@ -171,7 +171,7 @@ module Zakuro
|
|
171
171
|
prefix = "list[#{index}]. "
|
172
172
|
failed = []
|
173
173
|
|
174
|
-
failed.push(prefix + "invalid name. #{
|
174
|
+
failed.push(prefix + "invalid name. #{name}") unless name?
|
175
175
|
|
176
176
|
failed |= validate_both_start_year
|
177
177
|
|
@@ -187,9 +187,9 @@ module Zakuro
|
|
187
187
|
# @return [False] 正しくない
|
188
188
|
#
|
189
189
|
def name?
|
190
|
-
return false unless
|
190
|
+
return false unless name
|
191
191
|
|
192
|
-
|
192
|
+
name.is_a?(String)
|
193
193
|
end
|
194
194
|
|
195
195
|
#
|
@@ -198,7 +198,7 @@ module Zakuro
|
|
198
198
|
# @return [Array<String>] 不正メッセージ
|
199
199
|
#
|
200
200
|
def validate_both_start_year
|
201
|
-
Both::Year.new(hash:
|
201
|
+
Both::Year.new(hash: both_start_year).validate
|
202
202
|
end
|
203
203
|
|
204
204
|
#
|
@@ -207,7 +207,7 @@ module Zakuro
|
|
207
207
|
# @return [Array<String>] 不正メッセージ
|
208
208
|
#
|
209
209
|
def validate_both_start_date
|
210
|
-
Both::Date.new(hash:
|
210
|
+
Both::Date.new(hash: both_start_date).validate
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
@@ -242,9 +242,9 @@ module Zakuro
|
|
242
242
|
def validate
|
243
243
|
failed = []
|
244
244
|
|
245
|
-
failed.push("invalid japan year. #{
|
245
|
+
failed.push("invalid japan year. #{japan}") unless japan?
|
246
246
|
|
247
|
-
failed.push("invalid western year. #{
|
247
|
+
failed.push("invalid western year. #{western}") unless western?
|
248
248
|
|
249
249
|
failed
|
250
250
|
end
|
@@ -258,7 +258,7 @@ module Zakuro
|
|
258
258
|
def japan?
|
259
259
|
return false unless @japan
|
260
260
|
|
261
|
-
|
261
|
+
japan.is_a?(Integer)
|
262
262
|
end
|
263
263
|
|
264
264
|
#
|
@@ -270,7 +270,7 @@ module Zakuro
|
|
270
270
|
def western?
|
271
271
|
return false unless @western
|
272
272
|
|
273
|
-
|
273
|
+
western.is_a?(Integer)
|
274
274
|
end
|
275
275
|
end
|
276
276
|
|
@@ -301,9 +301,9 @@ module Zakuro
|
|
301
301
|
def validate
|
302
302
|
failed = []
|
303
303
|
|
304
|
-
failed.push("invalid japan date. #{
|
304
|
+
failed.push("invalid japan date. #{japan}") unless japan?
|
305
305
|
|
306
|
-
failed.push("invalid western date. #{
|
306
|
+
failed.push("invalid western date. #{western}") unless western?
|
307
307
|
|
308
308
|
failed
|
309
309
|
end
|
@@ -315,7 +315,7 @@ module Zakuro
|
|
315
315
|
# @return [False] 正しくない
|
316
316
|
#
|
317
317
|
def japan?
|
318
|
-
Japan::Calendar.valid_date_string(text:
|
318
|
+
Japan::Calendar.valid_date_string(text: japan)
|
319
319
|
end
|
320
320
|
|
321
321
|
#
|
@@ -325,20 +325,22 @@ module Zakuro
|
|
325
325
|
# @return [False] 正しくない
|
326
326
|
#
|
327
327
|
def western?
|
328
|
-
Western::Calendar.valid_date_string(text:
|
328
|
+
Western::Calendar.valid_date_string(text: western)
|
329
329
|
end
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
333
|
+
class << self
|
334
|
+
#
|
335
|
+
# 検証する
|
336
|
+
#
|
337
|
+
# @param [Hash<String, Object>] yaml_hash yaml取得結果
|
338
|
+
#
|
339
|
+
# @return [Array<String>] 不正メッセージ
|
340
|
+
#
|
341
|
+
def run(yaml_hash:)
|
342
|
+
Set.new(hash: yaml_hash).validate
|
343
|
+
end
|
342
344
|
end
|
343
345
|
end
|
344
346
|
end
|
@@ -19,33 +19,35 @@ module Zakuro
|
|
19
19
|
# @return [Integer] 2行目
|
20
20
|
SECOND_LINE = Alignment::Aligner::SECOND_LINE
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
class << self
|
23
|
+
#
|
24
|
+
# 該当行の元号を取得する
|
25
|
+
#
|
26
|
+
# @param [Integer] line 行番号
|
27
|
+
# @param [Western::Calendar] start_date 開始日
|
28
|
+
# @param [Western::Calendar] last_date 終了日
|
29
|
+
#
|
30
|
+
# @return [Array<LinearGengou>] 該当行の元号
|
31
|
+
#
|
32
|
+
def line(line: FIRST_LINE,
|
33
|
+
start_date: Western::Calendar.new, last_date: Western::Calendar.new)
|
34
|
+
Alignment.get(
|
35
|
+
line: line, start_date: start_date, last_date: last_date
|
36
|
+
)
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
#
|
40
|
+
# 該当行の元号を取得する(元号名)
|
41
|
+
#
|
42
|
+
# @param [Integer] line 行番号
|
43
|
+
# @param [Western::Calendar] start_date 開始日
|
44
|
+
# @param [Western::Calendar] last_date 終了日
|
45
|
+
#
|
46
|
+
# @return [Array<LinearGengou>] 該当行の元号
|
47
|
+
#
|
48
|
+
def line_by_name(line: FIRST_LINE, name:)
|
49
|
+
Alignment.get_by_name(line: line, name: name)
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -125,26 +125,28 @@ module Zakuro
|
|
125
125
|
)
|
126
126
|
].freeze
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
128
|
+
class << self
|
129
|
+
#
|
130
|
+
# 年を基準に暦を引き当てる
|
131
|
+
#
|
132
|
+
# @param [Integer] start_year 開始西暦年
|
133
|
+
# @param [Integer] last_year 終了西暦年
|
134
|
+
#
|
135
|
+
# @return [Array<Range>] 和暦
|
136
|
+
#
|
137
|
+
def ranges_with_year(start_year:, last_year:)
|
138
|
+
result = []
|
138
139
|
|
139
|
-
|
140
|
-
|
140
|
+
LIST.each do |range|
|
141
|
+
next if start_year > range.last_year
|
141
142
|
|
142
|
-
|
143
|
+
next if last_year < range.start_year
|
143
144
|
|
144
|
-
|
145
|
-
|
145
|
+
result.push(range)
|
146
|
+
end
|
146
147
|
|
147
|
-
|
148
|
+
result
|
149
|
+
end
|
148
150
|
end
|
149
151
|
end
|
150
152
|
end
|