zakuro 0.6.0 → 0.7.2
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 +58 -16
- 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 +50 -4
- data/lib/zakuro/calculation/base/linear_gengou.rb +6 -6
- data/lib/zakuro/calculation/base/operated_year.rb +3 -3
- data/lib/zakuro/calculation/base/year.rb +4 -4
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +5 -3
- data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +209 -0
- data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +30 -0
- data/lib/zakuro/calculation/era/gengou/internal/connector.rb +107 -0
- data/lib/zakuro/calculation/era/gengou/internal/counter.rb +214 -0
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +104 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +230 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +193 -0
- 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 +158 -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 +75 -0
- data/lib/zakuro/calculation/{gengou → era/gengou}/internal/reserve.rb +6 -7
- data/lib/zakuro/calculation/era/gengou/named_scroll.rb +30 -0
- data/lib/zakuro/calculation/{version → era/version}/internal/crawler.rb +7 -7
- data/lib/zakuro/calculation/{version → era/version}/internal/range.rb +4 -4
- data/lib/zakuro/calculation/{version → era/version}/version.rb +3 -3
- data/lib/zakuro/calculation/monthly/initialized_month.rb +1 -1
- data/lib/zakuro/calculation/monthly/month.rb +44 -5
- data/lib/zakuro/calculation/monthly/operated_month.rb +2 -2
- 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} +29 -27
- data/lib/zakuro/calculation/range/{operated_range.rb → abstract_operation_range.rb} +11 -14
- 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 +2 -2
- 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_terms.rb +9 -11
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +6 -6
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +2 -0
- data/lib/zakuro/calculation/summary/internal/day.rb +40 -0
- data/lib/zakuro/calculation/summary/internal/month.rb +92 -0
- data/lib/zakuro/calculation/summary/{single.rb → internal/operation.rb} +6 -40
- data/lib/zakuro/calculation/summary/internal/option.rb +85 -0
- data/lib/zakuro/calculation/summary/japan/range.rb +158 -0
- data/lib/zakuro/calculation/summary/japan/single.rb +118 -0
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +96 -0
- data/lib/zakuro/calculation/summary/western/range.rb +124 -0
- data/lib/zakuro/calculation/summary/western/single.rb +113 -0
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +174 -0
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +98 -0
- data/lib/zakuro/calculation/type/optional.rb +46 -0
- data/lib/zakuro/condition.rb +75 -22
- data/lib/zakuro/context/context.rb +44 -0
- data/lib/zakuro/context/option.rb +117 -0
- data/lib/zakuro/context/version_class_resolver.rb +110 -0
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +125 -0
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +168 -0
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +175 -0
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +187 -0
- data/lib/zakuro/era/japan/gengou/alignment.rb +55 -0
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +245 -0
- data/lib/zakuro/era/japan/gengou/resource/type.rb +299 -0
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +347 -0
- data/lib/zakuro/era/japan/gengou/{yaml → resource/yaml}/set-001-until-south.yaml +2 -2
- data/lib/zakuro/era/japan/gengou/{yaml → resource/yaml}/set-002-from-north.yaml +2 -2
- data/lib/zakuro/era/japan/gengou/{yaml → resource/yaml}/set-003-modern.yaml +2 -2
- data/lib/zakuro/era/japan/gengou/resource.rb +33 -0
- data/lib/zakuro/era/japan/gengou.rb +25 -79
- data/lib/zakuro/era/japan/version.rb +18 -18
- data/lib/zakuro/era/western/calendar.rb +13 -9
- 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 +37 -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 +70 -0
- data/lib/zakuro/merchant.rb +84 -12
- data/lib/zakuro/operation/month/parser.rb +11 -9
- data/lib/zakuro/operation/month/type.rb +31 -31
- data/lib/zakuro/operation/month/validator.rb +50 -50
- data/lib/zakuro/operation/yaml/month.yaml +3736 -3736
- data/lib/zakuro/output/logger.rb +17 -3
- data/lib/zakuro/output/response.rb +24 -57
- 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/bundle.rb +44 -0
- data/lib/zakuro/result/operation/month/annotation.rb +40 -0
- data/lib/zakuro/result/operation/month/bundle.rb +36 -0
- data/lib/zakuro/result/operation/month/history.rb +54 -0
- data/lib/zakuro/result/result.rb +21 -2
- data/lib/zakuro/tools/stringifier.rb +26 -3
- data/lib/zakuro/version/daien/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/daien/range/annual_range.rb +1 -1
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/daien/stella/lunar/value.rb +2 -0
- data/lib/zakuro/version/genka/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/genka/range/annual_range.rb +1 -1
- data/lib/zakuro/version/gihou/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/range/annual_range.rb +1 -1
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +2 -0
- data/lib/zakuro/version/senmyou/README.md +11 -7
- 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/option/dropped_date/parameter.rb +33 -0
- data/lib/zakuro/version/senmyou/range/annual_range.rb +1 -1
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +2 -0
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +2 -0
- metadata +85 -24
- data/lib/zakuro/calculation/gengou/internal/counter.rb +0 -129
- data/lib/zakuro/calculation/gengou/internal/reserve/interval.rb +0 -183
- data/lib/zakuro/calculation/gengou/internal/reserve/list.rb +0 -382
- data/lib/zakuro/calculation/gengou/scroll.rb +0 -262
- data/lib/zakuro/calculation/specifier/single_day.rb +0 -87
- data/lib/zakuro/era/japan/gengou/parser.rb +0 -237
- data/lib/zakuro/era/japan/gengou/type.rb +0 -285
- data/lib/zakuro/era/japan/gengou/validator.rb +0 -341
- data/lib/zakuro/result/data.rb +0 -187
- data/lib/zakuro/result/operation.rb +0 -114
- data/lib/zakuro/version/context.rb +0 -44
- data/lib/zakuro/version/version_class_resolver.rb +0 -74
@@ -135,7 +135,7 @@ module Zakuro
|
|
135
135
|
def self.western_date?(str: '')
|
136
136
|
return Western::Calendar.new if str == EMPTY_STRING
|
137
137
|
|
138
|
-
Western::Calendar.valid_date_string(
|
138
|
+
Western::Calendar.valid_date_string(text: str)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -150,7 +150,7 @@ module Zakuro
|
|
150
150
|
# @return [String] ID
|
151
151
|
attr_reader :id
|
152
152
|
# @return [String] 親ID
|
153
|
-
attr_reader :
|
153
|
+
attr_reader :parent_id
|
154
154
|
# @return [String] 西暦日
|
155
155
|
attr_reader :western_date
|
156
156
|
# @return [String] 有効行
|
@@ -461,14 +461,14 @@ module Zakuro
|
|
461
461
|
#
|
462
462
|
# @param [Integer] index 連番
|
463
463
|
# @param [Hash<String, Object>] yaml_hash yaml
|
464
|
-
# @option yaml_hash [Hash] :
|
465
|
-
# @option yaml_hash [Hash] :
|
464
|
+
# @option yaml_hash [Hash] :src 移動元
|
465
|
+
# @option yaml_hash [Hash] :dest 移動先
|
466
466
|
# @option yaml_hash [String] :days 中気差分
|
467
467
|
#
|
468
468
|
def initialize(index:, yaml_hash: {})
|
469
469
|
@index = index
|
470
|
-
@source = Source.new(diff_index: index, yaml_hash: yaml_hash['
|
471
|
-
@destination = Destination.new(diff_index: index, yaml_hash: yaml_hash['
|
470
|
+
@source = Source.new(diff_index: index, yaml_hash: yaml_hash['src'])
|
471
|
+
@destination = Destination.new(diff_index: index, yaml_hash: yaml_hash['dest'])
|
472
472
|
@days = yaml_hash['days']
|
473
473
|
end
|
474
474
|
|
@@ -537,7 +537,7 @@ module Zakuro
|
|
537
537
|
def validate
|
538
538
|
failed = []
|
539
539
|
|
540
|
-
prefix = "[#{@diff_index}][solar_term.
|
540
|
+
prefix = "[#{@diff_index}][solar_term.src] invalid"
|
541
541
|
|
542
542
|
failed.push("#{prefix} 'index'. #{@index}") unless index?
|
543
543
|
|
@@ -600,7 +600,7 @@ module Zakuro
|
|
600
600
|
def validate
|
601
601
|
failed = []
|
602
602
|
|
603
|
-
prefix = "[#{@diff_index}][solar_term.
|
603
|
+
prefix = "[#{@diff_index}][solar_term.dest] invalid"
|
604
604
|
|
605
605
|
failed.push("#{prefix} 'index'. #{@index}") unless index?
|
606
606
|
|
@@ -633,23 +633,23 @@ module Zakuro
|
|
633
633
|
|
634
634
|
# @return [Integer] 連番
|
635
635
|
attr_reader :index
|
636
|
-
# @return [String]
|
637
|
-
attr_reader :
|
638
|
-
# @return [String]
|
639
|
-
attr_reader :
|
636
|
+
# @return [String] 移動元
|
637
|
+
attr_reader :src
|
638
|
+
# @return [String] 移動先
|
639
|
+
attr_reader :dest
|
640
640
|
|
641
641
|
#
|
642
642
|
# 初期化
|
643
643
|
#
|
644
644
|
# @param [Integer] index 連番
|
645
645
|
# @param [Hash<String, String>] yaml_hash yaml
|
646
|
-
# @option yaml_hash [String] :
|
647
|
-
# @option yaml_hash [String] :
|
646
|
+
# @option yaml_hash [String] :src 移動元
|
647
|
+
# @option yaml_hash [String] :dest 移動先
|
648
648
|
#
|
649
649
|
def initialize(index:, yaml_hash: {})
|
650
650
|
@index = index
|
651
|
-
@
|
652
|
-
@
|
651
|
+
@src = yaml_hash['src']
|
652
|
+
@dest = yaml_hash['dest']
|
653
653
|
end
|
654
654
|
|
655
655
|
#
|
@@ -662,19 +662,19 @@ module Zakuro
|
|
662
662
|
|
663
663
|
prefix = "[#{@index}][#{NAME}] invalid"
|
664
664
|
|
665
|
-
failed.push("#{prefix} '
|
665
|
+
failed.push("#{prefix} 'src'. #{@src}") unless src?
|
666
666
|
|
667
|
-
failed.push("#{prefix} '
|
667
|
+
failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
|
668
668
|
|
669
669
|
failed
|
670
670
|
end
|
671
671
|
|
672
|
-
def
|
673
|
-
Types.positive?(str: @
|
672
|
+
def src?
|
673
|
+
Types.positive?(str: @src)
|
674
674
|
end
|
675
675
|
|
676
|
-
def
|
677
|
-
Types.positive?(str: @
|
676
|
+
def dest?
|
677
|
+
Types.positive?(str: @dest)
|
678
678
|
end
|
679
679
|
end
|
680
680
|
|
@@ -686,23 +686,23 @@ module Zakuro
|
|
686
686
|
|
687
687
|
# @return [Integer] 連番
|
688
688
|
attr_reader :index
|
689
|
-
# @return [String]
|
690
|
-
attr_reader :
|
691
|
-
# @return [String]
|
692
|
-
attr_reader :
|
689
|
+
# @return [String] 移動元
|
690
|
+
attr_reader :src
|
691
|
+
# @return [String] 移動先
|
692
|
+
attr_reader :dest
|
693
693
|
|
694
694
|
#
|
695
695
|
# 初期化
|
696
696
|
#
|
697
697
|
# @param [Integer] index 連番
|
698
698
|
# @param [Hash<String, String>] yaml_hash yaml
|
699
|
-
# @option yaml_hash [String] :
|
700
|
-
# @option yaml_hash [String] :
|
699
|
+
# @option yaml_hash [String] :src 移動元
|
700
|
+
# @option yaml_hash [String] :dest 移動先
|
701
701
|
#
|
702
702
|
def initialize(index:, yaml_hash: {})
|
703
703
|
@index = index
|
704
|
-
@
|
705
|
-
@
|
704
|
+
@src = yaml_hash['src']
|
705
|
+
@dest = yaml_hash['dest']
|
706
706
|
end
|
707
707
|
|
708
708
|
#
|
@@ -715,19 +715,19 @@ module Zakuro
|
|
715
715
|
|
716
716
|
prefix = "[#{@index}][#{NAME}] invalid"
|
717
717
|
|
718
|
-
failed.push("#{prefix} '
|
718
|
+
failed.push("#{prefix} 'src'. #{@src}") unless src?
|
719
719
|
|
720
|
-
failed.push("#{prefix} '
|
720
|
+
failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
|
721
721
|
|
722
722
|
failed
|
723
723
|
end
|
724
724
|
|
725
|
-
def
|
726
|
-
Types.empiable_bool?(str: @
|
725
|
+
def src?
|
726
|
+
Types.empiable_bool?(str: @src)
|
727
727
|
end
|
728
728
|
|
729
|
-
def
|
730
|
-
Types.empiable_bool?(str: @
|
729
|
+
def dest?
|
730
|
+
Types.empiable_bool?(str: @dest)
|
731
731
|
end
|
732
732
|
end
|
733
733
|
|
@@ -739,23 +739,23 @@ module Zakuro
|
|
739
739
|
|
740
740
|
# @return [Integer] 連番
|
741
741
|
attr_reader :index
|
742
|
-
# @return [String]
|
743
|
-
attr_reader :
|
744
|
-
# @return [String]
|
745
|
-
attr_reader :
|
742
|
+
# @return [String] 移動元
|
743
|
+
attr_reader :src
|
744
|
+
# @return [String] 移動先
|
745
|
+
attr_reader :dest
|
746
746
|
|
747
747
|
#
|
748
748
|
# 初期化
|
749
749
|
#
|
750
750
|
# @param [Integer] index 連番
|
751
751
|
# @param [Hash<String, String>] yaml_hash yaml
|
752
|
-
# @option yaml_hash [String] :
|
753
|
-
# @option yaml_hash [String] :
|
752
|
+
# @option yaml_hash [String] :src 移動元
|
753
|
+
# @option yaml_hash [String] :dest 移動先
|
754
754
|
#
|
755
755
|
def initialize(index:, yaml_hash: {})
|
756
756
|
@index = index
|
757
|
-
@
|
758
|
-
@
|
757
|
+
@src = yaml_hash['src']
|
758
|
+
@dest = yaml_hash['dest']
|
759
759
|
end
|
760
760
|
|
761
761
|
#
|
@@ -768,19 +768,19 @@ module Zakuro
|
|
768
768
|
|
769
769
|
prefix = "[#{@index}][#{NAME}] invalid"
|
770
770
|
|
771
|
-
failed.push("#{prefix} '
|
771
|
+
failed.push("#{prefix} 'src'. #{@src}") unless src?
|
772
772
|
|
773
|
-
failed.push("#{prefix} '
|
773
|
+
failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
|
774
774
|
|
775
775
|
failed
|
776
776
|
end
|
777
777
|
|
778
|
-
def
|
779
|
-
Types.month_days?(str: @
|
778
|
+
def src?
|
779
|
+
Types.month_days?(str: @src)
|
780
780
|
end
|
781
781
|
|
782
|
-
def
|
783
|
-
Types.month_days?(str: @
|
782
|
+
def dest?
|
783
|
+
Types.month_days?(str: @dest)
|
784
784
|
end
|
785
785
|
end
|
786
786
|
|