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
@@ -58,26 +58,28 @@ module Zakuro
|
|
58
58
|
Type::DEFAULT => Date::ITALY
|
59
59
|
}.freeze
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
class << self
|
62
|
+
#
|
63
|
+
# 日付種別からRuby標準のグレゴリオ暦開始日を引き当てる
|
64
|
+
#
|
65
|
+
# @param [Symbol] type 日付種別
|
66
|
+
#
|
67
|
+
# @return [Integer] Ruby標準のグレゴリオ暦開始日
|
68
|
+
#
|
69
|
+
def to_native_start(type:)
|
70
|
+
DATE_START.fetch(type, DATE_START[Type::DEFAULT])
|
71
|
+
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
#
|
74
|
+
# Ruby標準のグレゴリオ暦開始日から日付種別を引き当てる
|
75
|
+
#
|
76
|
+
# @param [Integer] start Ruby標準のグレゴリオ暦開始日
|
77
|
+
#
|
78
|
+
# @return [Symbol] 日付種別
|
79
|
+
#
|
80
|
+
def to_type(start:)
|
81
|
+
DATE_START.invert.fetch(start, Type::DEFAULT)
|
82
|
+
end
|
81
83
|
end
|
82
84
|
|
83
85
|
#
|
@@ -131,8 +133,16 @@ module Zakuro
|
|
131
133
|
# 定数 DATE_START のバリエーションで日付オブジェクトを初期化するだけで良い
|
132
134
|
#
|
133
135
|
class Calendar # rubocop:disable Metrics/ClassLength
|
134
|
-
|
136
|
+
# @return [Parameter] 初期化引数
|
137
|
+
attr_reader :param
|
138
|
+
# @return [Date] 日付(Ruby日付型)
|
139
|
+
attr_reader :date
|
135
140
|
|
141
|
+
#
|
142
|
+
# 検証する
|
143
|
+
#
|
144
|
+
# @return [Array<String>] エラー文字列
|
145
|
+
#
|
136
146
|
def validate
|
137
147
|
failed = valid_type
|
138
148
|
|
@@ -150,9 +160,9 @@ module Zakuro
|
|
150
160
|
#
|
151
161
|
def valid_type
|
152
162
|
failed = []
|
153
|
-
year =
|
154
|
-
month =
|
155
|
-
day =
|
163
|
+
year = param.year
|
164
|
+
month = param.month
|
165
|
+
day = param.day
|
156
166
|
failed.push("wrong type. year: #{year}") unless year.is_a?(Integer)
|
157
167
|
failed.push("wrong type. month: #{month}") unless month.is_a?(Integer)
|
158
168
|
failed.push("wrong type. day: #{day}") unless day.is_a?(Integer)
|
@@ -169,10 +179,10 @@ module Zakuro
|
|
169
179
|
def valid_date
|
170
180
|
failed = []
|
171
181
|
|
172
|
-
year =
|
173
|
-
month =
|
174
|
-
day =
|
175
|
-
start =
|
182
|
+
year = param.year
|
183
|
+
month = param.month
|
184
|
+
day = param.day
|
185
|
+
start = param.start
|
176
186
|
unless Date.valid_date?(year, month, day, start)
|
177
187
|
failed.push("year: #{year}, month: #{month}, " \
|
178
188
|
"day: #{day}, start: #{start}")
|
@@ -215,7 +225,7 @@ module Zakuro
|
|
215
225
|
#
|
216
226
|
def redate(type: Type::DEFAULT)
|
217
227
|
start = DATE_START.fetch(type, DATE_START[Type::DEFAULT])
|
218
|
-
@date =
|
228
|
+
@date = date.new_start(start)
|
219
229
|
self
|
220
230
|
end
|
221
231
|
|
@@ -227,7 +237,7 @@ module Zakuro
|
|
227
237
|
# @return [Calendar] 年月日情報(西暦)
|
228
238
|
#
|
229
239
|
def +(other)
|
230
|
-
return
|
240
|
+
return date.jd + other.date.jd if other.is_a?(Western::Calendar)
|
231
241
|
|
232
242
|
@date += other
|
233
243
|
self
|
@@ -241,7 +251,7 @@ module Zakuro
|
|
241
251
|
# @return [Calendar] 年月日情報(西暦)
|
242
252
|
#
|
243
253
|
def -(other)
|
244
|
-
return
|
254
|
+
return date.jd - other.date.jd if other.is_a?(Western::Calendar)
|
245
255
|
|
246
256
|
@date -= other
|
247
257
|
self
|
@@ -256,7 +266,7 @@ module Zakuro
|
|
256
266
|
# @return [False] 以下(現在日/過去日である)
|
257
267
|
#
|
258
268
|
def >(other)
|
259
|
-
|
269
|
+
date > other.date
|
260
270
|
end
|
261
271
|
|
262
272
|
#
|
@@ -268,7 +278,7 @@ module Zakuro
|
|
268
278
|
# @return [False] より小さい(過去日である)
|
269
279
|
#
|
270
280
|
def >=(other)
|
271
|
-
|
281
|
+
date >= other.date
|
272
282
|
end
|
273
283
|
|
274
284
|
#
|
@@ -280,7 +290,7 @@ module Zakuro
|
|
280
290
|
# @return [False] 以上(現在日/未来日である)
|
281
291
|
#
|
282
292
|
def <(other)
|
283
|
-
|
293
|
+
date < other.date
|
284
294
|
end
|
285
295
|
|
286
296
|
#
|
@@ -292,7 +302,7 @@ module Zakuro
|
|
292
302
|
# @return [False] より大きい(未来日である)
|
293
303
|
#
|
294
304
|
def <=(other)
|
295
|
-
|
305
|
+
date <= other.date
|
296
306
|
end
|
297
307
|
|
298
308
|
#
|
@@ -304,7 +314,7 @@ module Zakuro
|
|
304
314
|
# @return [False] 等しくない(過去日/未来日である)
|
305
315
|
#
|
306
316
|
def ==(other)
|
307
|
-
|
317
|
+
date == other.date
|
308
318
|
end
|
309
319
|
|
310
320
|
#
|
@@ -313,7 +323,7 @@ module Zakuro
|
|
313
323
|
# @return [Integer] 年
|
314
324
|
#
|
315
325
|
def year
|
316
|
-
|
326
|
+
date.year
|
317
327
|
end
|
318
328
|
|
319
329
|
#
|
@@ -322,7 +332,7 @@ module Zakuro
|
|
322
332
|
# @return [Integer] 月
|
323
333
|
#
|
324
334
|
def month
|
325
|
-
|
335
|
+
date.month
|
326
336
|
end
|
327
337
|
|
328
338
|
#
|
@@ -331,7 +341,7 @@ module Zakuro
|
|
331
341
|
# @return [Integer] 日
|
332
342
|
#
|
333
343
|
def day
|
334
|
-
|
344
|
+
date.day
|
335
345
|
end
|
336
346
|
|
337
347
|
#
|
@@ -342,7 +352,7 @@ module Zakuro
|
|
342
352
|
# @return [Calendar] 年月日情報(西暦)
|
343
353
|
#
|
344
354
|
def next_year(num: 1)
|
345
|
-
@date =
|
355
|
+
@date = date.next_year(num)
|
346
356
|
self
|
347
357
|
end
|
348
358
|
|
@@ -353,7 +363,7 @@ module Zakuro
|
|
353
363
|
# @return [False] 無効値以外
|
354
364
|
#
|
355
365
|
def invalid?
|
356
|
-
(
|
366
|
+
(date == Date.new)
|
357
367
|
end
|
358
368
|
|
359
369
|
#
|
@@ -364,62 +374,64 @@ module Zakuro
|
|
364
374
|
# @return [String] 年月日情報
|
365
375
|
#
|
366
376
|
def format(form: '%Y-%m-%d')
|
367
|
-
|
377
|
+
date.strftime(form)
|
368
378
|
end
|
369
379
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
#
|
384
|
-
# 年月日情報(西暦)を生成する
|
385
|
-
#
|
386
|
-
# @param [String] text 日付文字列
|
387
|
-
# @param [Symbol] type 日付種別
|
388
|
-
#
|
389
|
-
# @return [Calendar] 年月日情報(西暦)
|
390
|
-
#
|
391
|
-
# @raise [ArgumentError] 引数エラー
|
392
|
-
#
|
393
|
-
def self.parse(text: '', type: Type::DEFAULT)
|
394
|
-
unless Calendar.valid_date_string(text: text, type: type)
|
395
|
-
raise ArgumentError, "invalid date string: #{text}"
|
380
|
+
class << self
|
381
|
+
#
|
382
|
+
# 年月日情報(西暦)を生成する
|
383
|
+
#
|
384
|
+
# @param [Date] date Ruby標準日付
|
385
|
+
#
|
386
|
+
# @return [Calendar] 年月日情報(西暦)
|
387
|
+
#
|
388
|
+
def create(date: Date.new)
|
389
|
+
type = Western.to_type(start: date.start)
|
390
|
+
Calendar.new(year: date.year, month: date.month,
|
391
|
+
day: date.day, type: type)
|
396
392
|
end
|
397
393
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
394
|
+
#
|
395
|
+
# 年月日情報(西暦)を生成する
|
396
|
+
#
|
397
|
+
# @param [String] text 日付文字列
|
398
|
+
# @param [Symbol] type 日付種別
|
399
|
+
#
|
400
|
+
# @return [Calendar] 年月日情報(西暦)
|
401
|
+
#
|
402
|
+
# @raise [ArgumentError] 引数エラー
|
403
|
+
#
|
404
|
+
def parse(text: '', type: Type::DEFAULT)
|
405
|
+
unless valid_date_string(text: text, type: type)
|
406
|
+
raise ArgumentError, "invalid date string: #{text}"
|
407
|
+
end
|
408
|
+
|
409
|
+
start = DATE_START.fetch(type, DATE_START[Type::DEFAULT])
|
410
|
+
date = Date.parse(text, start)
|
411
|
+
|
412
|
+
Calendar.new(
|
413
|
+
year: date.year, month: date.month, day: date.day, type: type
|
414
|
+
)
|
415
|
+
end
|
405
416
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
417
|
+
#
|
418
|
+
# 日付文字列を検証する
|
419
|
+
#
|
420
|
+
# @param [String] text 日付文字列
|
421
|
+
# @param [Symbol] type 日付種別
|
422
|
+
#
|
423
|
+
# @return [True] 正しい
|
424
|
+
# @return [True] 正しくない
|
425
|
+
#
|
426
|
+
def valid_date_string(text: '', type: Type::DEFAULT)
|
427
|
+
start = DATE_START.fetch(type, DATE_START[Type::DEFAULT])
|
428
|
+
begin
|
429
|
+
Date.parse(text, start)
|
430
|
+
rescue ArgumentError => _e
|
431
|
+
return false
|
432
|
+
end
|
433
|
+
true
|
421
434
|
end
|
422
|
-
true
|
423
435
|
end
|
424
436
|
end
|
425
437
|
end
|
@@ -34,7 +34,7 @@ module Zakuro
|
|
34
34
|
# @return [String] エラーコード
|
35
35
|
#
|
36
36
|
def code
|
37
|
-
|
37
|
+
template.code
|
38
38
|
end
|
39
39
|
|
40
40
|
#
|
@@ -43,7 +43,7 @@ module Zakuro
|
|
43
43
|
# @return [String] メッセージ
|
44
44
|
#
|
45
45
|
def message
|
46
|
-
|
46
|
+
template.format(*args)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -18,20 +18,22 @@ module Zakuro
|
|
18
18
|
# @return [String] 共通メッセージ
|
19
19
|
MESSAGE = 'an error has occurred'
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
class << self
|
22
|
+
#
|
23
|
+
# 例外を取得する
|
24
|
+
#
|
25
|
+
# @param [Array<Case::Preset>] presets 原因プリセット
|
26
|
+
#
|
27
|
+
# @return [ZakuroError] ライブラリエラー
|
28
|
+
#
|
29
|
+
def get(presets: [])
|
30
|
+
causes = []
|
31
|
+
presets.each do |preset|
|
32
|
+
causes.push(Cause.new(code: preset.code, message: preset.message))
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
+
ZakuroError.new(msg: MESSAGE, causes: causes)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -51,7 +51,7 @@ module Zakuro
|
|
51
51
|
# @return [False] 不正なし
|
52
52
|
#
|
53
53
|
def invalid_japan?
|
54
|
-
|
54
|
+
japan_date.invalid?
|
55
55
|
end
|
56
56
|
|
57
57
|
#
|
@@ -71,7 +71,7 @@ module Zakuro
|
|
71
71
|
# @return [False] 不正なし
|
72
72
|
#
|
73
73
|
def invalid_western?
|
74
|
-
|
74
|
+
western_date.invalid?
|
75
75
|
end
|
76
76
|
|
77
77
|
#
|
@@ -39,7 +39,7 @@ module Zakuro
|
|
39
39
|
# @return [False] 無効
|
40
40
|
#
|
41
41
|
def valid_western?
|
42
|
-
|
42
|
+
start_date.valid_western? && last_date.valid_western?
|
43
43
|
end
|
44
44
|
|
45
45
|
#
|
@@ -49,7 +49,7 @@ module Zakuro
|
|
49
49
|
# @return [False] 無効
|
50
50
|
#
|
51
51
|
def valid_japan?
|
52
|
-
|
52
|
+
start_date.valid_japan? && last_date.valid_japan?
|
53
53
|
end
|
54
54
|
|
55
55
|
#
|
@@ -59,7 +59,7 @@ module Zakuro
|
|
59
59
|
# @return [False] 不正なし
|
60
60
|
#
|
61
61
|
def invalid?
|
62
|
-
|
62
|
+
start_date.invalid? && last_date.invalid?
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/lib/zakuro/gateway/range.rb
CHANGED
@@ -36,7 +36,7 @@ module Zakuro
|
|
36
36
|
# @return [False] 不正なし
|
37
37
|
#
|
38
38
|
def invalid?
|
39
|
-
|
39
|
+
date.invalid?
|
40
40
|
end
|
41
41
|
|
42
42
|
#
|
@@ -57,7 +57,18 @@ module Zakuro
|
|
57
57
|
)
|
58
58
|
end
|
59
59
|
|
60
|
-
raise
|
60
|
+
raise invalid_date_error
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
#
|
66
|
+
# 日付不正エラーを取得する
|
67
|
+
#
|
68
|
+
# @return [ZakuroError] ライブラリエラー
|
69
|
+
#
|
70
|
+
def invalid_date_error
|
71
|
+
Exception.get(
|
61
72
|
presets: [
|
62
73
|
Exception::Case::Preset.new(
|
63
74
|
template: Exception::Case::Pattern::INVALID_DATE
|
data/lib/zakuro/merchant.rb
CHANGED