zakuro 0.6.1 → 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/Makefile +3 -0
- data/README.md +46 -17
- data/VERSION +1 -1
- data/doc/dropped_date.md +93 -0
- data/doc/error.md +45 -0
- data/doc/operation/transfer.rb +8 -8
- data/lib/zakuro/calculation/base/day.rb +52 -0
- data/lib/zakuro/calculation/base/gengou.rb +49 -3
- data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
- data/lib/zakuro/calculation/base/operated_year.rb +26 -24
- data/lib/zakuro/calculation/base/year.rb +7 -7
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +55 -47
- 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/{scroll.rb → abstract_scroll.rb} +44 -37
- data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +30 -0
- 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/{list.rb → abstract_list.rb} +50 -64
- data/lib/zakuro/calculation/era/gengou/internal/reserve/{range.rb → abstract_range.rb} +73 -50
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +48 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +30 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +156 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +125 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +73 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +23 -22
- data/lib/zakuro/calculation/era/gengou/named_scroll.rb +30 -0
- 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 +40 -38
- data/lib/zakuro/calculation/monthly/month.rb +55 -16
- data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
- data/lib/zakuro/calculation/monthly/operated_month.rb +37 -86
- data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
- data/lib/zakuro/calculation/option/dropped_date/abstract_parameter.rb +44 -0
- data/lib/zakuro/calculation/option/dropped_date/location.rb +135 -0
- data/lib/zakuro/calculation/range/{full_range.rb → abstract_full_range.rb} +45 -29
- data/lib/zakuro/calculation/range/abstract_operation_range.rb +193 -0
- data/lib/zakuro/calculation/range/dated_full_range.rb +32 -0
- data/lib/zakuro/calculation/range/dated_operation_range.rb +33 -0
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +64 -63
- data/lib/zakuro/calculation/range/named_full_range.rb +38 -0
- data/lib/zakuro/calculation/range/named_operation_range.rb +36 -0
- 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 +7 -5
- data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
- data/lib/zakuro/calculation/summary/internal/day.rb +42 -0
- data/lib/zakuro/calculation/{specifier → summary}/internal/month.rb +33 -12
- data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
- data/lib/zakuro/calculation/summary/internal/option.rb +101 -0
- data/lib/zakuro/calculation/summary/japan/range.rb +179 -0
- data/lib/zakuro/calculation/summary/japan/single.rb +118 -0
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +98 -0
- data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
- data/lib/zakuro/calculation/summary/western/range.rb +127 -0
- data/lib/zakuro/calculation/summary/western/single.rb +115 -0
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +173 -0
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +100 -0
- data/lib/zakuro/calculation/type/old_float.rb +2 -2
- data/lib/zakuro/calculation/type/optional.rb +46 -0
- data/lib/zakuro/condition.rb +143 -94
- data/lib/zakuro/context/context.rb +44 -0
- data/lib/zakuro/context/option.rb +119 -0
- data/lib/zakuro/context/version_class_resolver.rb +112 -0
- data/lib/zakuro/era/japan/calendar.rb +35 -33
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +93 -74
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +135 -133
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +143 -122
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +177 -168
- data/lib/zakuro/era/japan/gengou/alignment.rb +40 -25
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +199 -181
- data/lib/zakuro/era/japan/gengou/resource/type.rb +243 -234
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +257 -254
- data/lib/zakuro/era/japan/gengou/resource.rb +23 -22
- data/lib/zakuro/era/japan/gengou.rb +28 -41
- data/lib/zakuro/era/japan/version.rb +18 -16
- data/lib/zakuro/era/western/calendar.rb +104 -88
- data/lib/zakuro/exception/case/pattern.rb +71 -0
- data/lib/zakuro/exception/case/preset.rb +51 -0
- data/lib/zakuro/exception/case/template.rb +48 -0
- data/lib/zakuro/exception/cause.rb +28 -0
- data/lib/zakuro/exception/exception.rb +39 -0
- data/lib/zakuro/exception/zakuro_error.rb +46 -0
- data/lib/zakuro/gateway/locale/date.rb +127 -0
- data/lib/zakuro/gateway/locale/range.rb +67 -0
- data/lib/zakuro/gateway/range.rb +99 -0
- data/lib/zakuro/gateway/single.rb +81 -0
- data/lib/zakuro/merchant.rb +67 -33
- data/lib/zakuro/operation/month/parser.rb +252 -249
- data/lib/zakuro/operation/month/type.rb +44 -35
- data/lib/zakuro/operation/month/validator.rb +182 -178
- data/lib/zakuro/operation/operation.rb +38 -36
- data/lib/zakuro/operation/yaml/month.yaml +3736 -3736
- data/lib/zakuro/output/logger.rb +17 -3
- data/lib/zakuro/output/response.rb +107 -141
- data/lib/zakuro/result/data/day.rb +43 -0
- data/lib/zakuro/result/data/gengou.rb +35 -0
- data/lib/zakuro/result/data/month.rb +63 -0
- data/lib/zakuro/result/data/option/abstract_option.rb +37 -0
- data/lib/zakuro/result/data/option/dropped_date/calculation.rb +47 -0
- data/lib/zakuro/result/data/option/dropped_date/option.rb +47 -0
- data/lib/zakuro/result/data/option/dropped_date/solar_term.rb +48 -0
- data/lib/zakuro/result/data/single_day.rb +56 -0
- data/lib/zakuro/result/data/solar_term.rb +35 -0
- data/lib/zakuro/result/data/year.rb +45 -0
- data/lib/zakuro/result/operation/month/annotation.rb +40 -0
- data/lib/zakuro/result/operation/month/history.rb +54 -0
- data/lib/zakuro/result/operation/month.rb +31 -0
- data/lib/zakuro/result/operation.rb +22 -97
- data/lib/zakuro/result/result.rb +6 -4
- data/lib/zakuro/tools/stringifier.rb +67 -42
- data/lib/zakuro/tools/typeconv.rb +17 -15
- data/lib/zakuro/tools/typeof.rb +15 -13
- data/lib/zakuro/version/daien/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -37
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -47
- 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 +4 -4
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +31 -0
- 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/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -37
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -47
- 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/const/remainder.rb +5 -0
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +37 -2
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +10 -10
- data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +33 -0
- data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -36
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -34
- 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 +68 -16
- data/lib/zakuro/calculation/range/operated_range.rb +0 -193
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -220
- data/lib/zakuro/calculation/specifier/multiple_day.rb +0 -162
- data/lib/zakuro/calculation/specifier/single_day.rb +0 -87
- data/lib/zakuro/calculation/summary/range.rb +0 -120
- data/lib/zakuro/calculation/summary/single.rb +0 -110
- data/lib/zakuro/result/data.rb +0 -187
- data/lib/zakuro/version/context.rb +0 -44
- data/lib/zakuro/version/version_class_resolver.rb +0 -74
@@ -250,7 +250,7 @@ module Zakuro
|
|
250
250
|
# @return [False] 有効
|
251
251
|
#
|
252
252
|
def invalid_days?
|
253
|
-
|
253
|
+
days == INVALID_DAY_VALUE
|
254
254
|
end
|
255
255
|
|
256
256
|
#
|
@@ -260,7 +260,7 @@ module Zakuro
|
|
260
260
|
# @return [False] 有効
|
261
261
|
#
|
262
262
|
def invalid?
|
263
|
-
|
263
|
+
source.invalid? && destination.invalid?
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
@@ -295,7 +295,7 @@ module Zakuro
|
|
295
295
|
# @return [False] 有効
|
296
296
|
#
|
297
297
|
def invalid?
|
298
|
-
|
298
|
+
index == -1
|
299
299
|
end
|
300
300
|
end
|
301
301
|
|
@@ -330,7 +330,7 @@ module Zakuro
|
|
330
330
|
# @return [False] 有効
|
331
331
|
#
|
332
332
|
def invalid?
|
333
|
-
|
333
|
+
index == -1
|
334
334
|
end
|
335
335
|
end
|
336
336
|
end
|
@@ -339,20 +339,20 @@ module Zakuro
|
|
339
339
|
# Number 月
|
340
340
|
#
|
341
341
|
class Number
|
342
|
-
# @return [Integer]
|
343
|
-
attr_reader :
|
344
|
-
# @return [Integer]
|
345
|
-
attr_reader :
|
342
|
+
# @return [Integer] 移動元
|
343
|
+
attr_reader :src
|
344
|
+
# @return [Integer] 移動先
|
345
|
+
attr_reader :dest
|
346
346
|
|
347
347
|
#
|
348
348
|
# 初期化
|
349
349
|
#
|
350
|
-
# @param [Integer]
|
351
|
-
# @param [Integer]
|
350
|
+
# @param [Integer] src 移動元
|
351
|
+
# @param [Integer] dest 移動先
|
352
352
|
#
|
353
|
-
def initialize(
|
354
|
-
@
|
355
|
-
@
|
353
|
+
def initialize(src: -1, dest: -1)
|
354
|
+
@src = src
|
355
|
+
@dest = dest
|
356
356
|
end
|
357
357
|
|
358
358
|
#
|
@@ -362,7 +362,7 @@ module Zakuro
|
|
362
362
|
# @return [False] 有効
|
363
363
|
#
|
364
364
|
def invalid?
|
365
|
-
|
365
|
+
src == -1 || dest == -1
|
366
366
|
end
|
367
367
|
|
368
368
|
#
|
@@ -381,7 +381,7 @@ module Zakuro
|
|
381
381
|
# @return [Integer] 間隔
|
382
382
|
#
|
383
383
|
def interval
|
384
|
-
|
384
|
+
src - dest
|
385
385
|
end
|
386
386
|
|
387
387
|
#
|
@@ -428,22 +428,22 @@ module Zakuro
|
|
428
428
|
# Leaped 閏有無
|
429
429
|
#
|
430
430
|
class Leaped
|
431
|
-
# @return [True, False]
|
432
|
-
attr_reader :
|
433
|
-
# @return [True, False]
|
434
|
-
attr_reader :
|
431
|
+
# @return [True, False] 移動元
|
432
|
+
attr_reader :src
|
433
|
+
# @return [True, False] 移動先
|
434
|
+
attr_reader :dest
|
435
435
|
|
436
436
|
# :reek:BooleanParameter
|
437
437
|
|
438
438
|
#
|
439
439
|
# 初期化
|
440
440
|
#
|
441
|
-
# @param [True, False]
|
442
|
-
# @param [True, False]
|
441
|
+
# @param [True, False] src 移動元
|
442
|
+
# @param [True, False] dest 移動先
|
443
443
|
#
|
444
|
-
def initialize(
|
445
|
-
@
|
446
|
-
@
|
444
|
+
def initialize(src: false, dest: false)
|
445
|
+
@src = src
|
446
|
+
@dest = dest
|
447
447
|
end
|
448
448
|
|
449
449
|
#
|
@@ -453,7 +453,7 @@ module Zakuro
|
|
453
453
|
# @return [False] 有効
|
454
454
|
#
|
455
455
|
def invalid?
|
456
|
-
|
456
|
+
!src && !dest
|
457
457
|
end
|
458
458
|
end
|
459
459
|
|
@@ -466,15 +466,24 @@ module Zakuro
|
|
466
466
|
# @return [String] 30日
|
467
467
|
BIG = '大'
|
468
468
|
|
469
|
+
# NOTE: 下記readerは不要とする
|
470
|
+
# * Number/Leaped とメソッド名を揃えている
|
471
|
+
# * 大小の真偽値が必要で、文字列ではない
|
472
|
+
#
|
473
|
+
# @return [String] 移動元
|
474
|
+
# attr_reader :src
|
475
|
+
# @return [String] 移動先
|
476
|
+
# attr_reader :dest
|
477
|
+
|
469
478
|
#
|
470
479
|
# 初期化
|
471
480
|
#
|
472
|
-
# @param [String]
|
473
|
-
# @param [String]
|
481
|
+
# @param [String] src 移動元
|
482
|
+
# @param [String] dest 移動先
|
474
483
|
#
|
475
|
-
def initialize(
|
476
|
-
@
|
477
|
-
@
|
484
|
+
def initialize(src: '小', dest: '小')
|
485
|
+
@src = src
|
486
|
+
@dest = dest
|
478
487
|
end
|
479
488
|
|
480
489
|
#
|
@@ -483,8 +492,8 @@ module Zakuro
|
|
483
492
|
# @return [True] 大
|
484
493
|
# @return [False] 小
|
485
494
|
#
|
486
|
-
def
|
487
|
-
@
|
495
|
+
def src
|
496
|
+
@src == BIG
|
488
497
|
end
|
489
498
|
|
490
499
|
#
|
@@ -493,8 +502,8 @@ module Zakuro
|
|
493
502
|
# @return [True] 大
|
494
503
|
# @return [False] 小
|
495
504
|
#
|
496
|
-
def
|
497
|
-
@
|
505
|
+
def dest
|
506
|
+
@dest == BIG
|
498
507
|
end
|
499
508
|
|
500
509
|
#
|
@@ -504,7 +513,7 @@ module Zakuro
|
|
504
513
|
# @return [False] 有効
|
505
514
|
#
|
506
515
|
def invalid?
|
507
|
-
@
|
516
|
+
@src == @dest
|
508
517
|
end
|
509
518
|
end
|
510
519
|
end
|