zakuro 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/VERSION +1 -1
  4. data/lib/zakuro/calculation/base/gengou.rb +5 -5
  5. data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
  6. data/lib/zakuro/calculation/base/operated_year.rb +23 -21
  7. data/lib/zakuro/calculation/base/year.rb +3 -3
  8. data/lib/zakuro/calculation/cycle/abstract_remainder.rb +50 -44
  9. data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +28 -24
  10. data/lib/zakuro/calculation/cycle/zodiac.rb +22 -20
  11. data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +38 -29
  12. data/lib/zakuro/calculation/era/gengou/internal/connector.rb +4 -4
  13. data/lib/zakuro/calculation/era/gengou/internal/counter.rb +16 -16
  14. data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +74 -72
  15. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +16 -16
  16. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +58 -35
  17. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +3 -3
  18. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +111 -113
  19. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +6 -6
  20. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +7 -9
  21. data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +22 -20
  22. data/lib/zakuro/calculation/era/version/internal/crawler.rb +39 -22
  23. data/lib/zakuro/calculation/era/version/version.rb +12 -10
  24. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +13 -9
  25. data/lib/zakuro/calculation/monthly/const.rb +18 -0
  26. data/lib/zakuro/calculation/monthly/initialized_month.rb +39 -37
  27. data/lib/zakuro/calculation/monthly/month.rb +15 -15
  28. data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
  29. data/lib/zakuro/calculation/monthly/operated_month.rb +36 -85
  30. data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
  31. data/lib/zakuro/calculation/range/abstract_full_range.rb +34 -21
  32. data/lib/zakuro/calculation/range/abstract_operation_range.rb +109 -107
  33. data/lib/zakuro/calculation/range/medieval_annual_range.rb +64 -63
  34. data/lib/zakuro/calculation/range/operated_solar_term.rb +220 -0
  35. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +32 -29
  36. data/lib/zakuro/calculation/range/transfer/year_boundary.rb +115 -117
  37. data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +1 -1
  38. data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +48 -46
  39. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +31 -26
  40. data/lib/zakuro/calculation/stella/solar/abstract_location.rb +5 -5
  41. data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
  42. data/lib/zakuro/calculation/summary/internal/day.rb +21 -19
  43. data/lib/zakuro/calculation/summary/internal/month.rb +25 -12
  44. data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
  45. data/lib/zakuro/calculation/summary/internal/option.rb +66 -50
  46. data/lib/zakuro/calculation/summary/japan/range.rb +145 -124
  47. data/lib/zakuro/calculation/summary/japan/single.rb +87 -87
  48. data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +54 -52
  49. data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
  50. data/lib/zakuro/calculation/summary/western/range.rb +95 -92
  51. data/lib/zakuro/calculation/summary/western/single.rb +78 -76
  52. data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +123 -124
  53. data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +60 -58
  54. data/lib/zakuro/calculation/type/old_float.rb +2 -2
  55. data/lib/zakuro/condition.rb +121 -111
  56. data/lib/zakuro/context/context.rb +1 -1
  57. data/lib/zakuro/context/option.rb +31 -29
  58. data/lib/zakuro/context/version_class_resolver.rb +26 -24
  59. data/lib/zakuro/era/japan/calendar.rb +35 -33
  60. data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +4 -4
  61. data/lib/zakuro/era/japan/gengou/alignment/division.rb +117 -118
  62. data/lib/zakuro/era/japan/gengou/alignment/line.rb +7 -5
  63. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +20 -14
  64. data/lib/zakuro/era/japan/gengou/alignment.rb +27 -25
  65. data/lib/zakuro/era/japan/gengou/resource/parser.rb +51 -36
  66. data/lib/zakuro/era/japan/gengou/resource/type.rb +39 -37
  67. data/lib/zakuro/era/japan/gengou/resource/validator.rb +34 -32
  68. data/lib/zakuro/era/japan/gengou.rb +28 -26
  69. data/lib/zakuro/era/japan/version.rb +18 -16
  70. data/lib/zakuro/era/western/calendar.rb +102 -90
  71. data/lib/zakuro/exception/case/preset.rb +2 -2
  72. data/lib/zakuro/exception/exception.rb +15 -13
  73. data/lib/zakuro/exception/zakuro_error.rb +1 -1
  74. data/lib/zakuro/gateway/locale/date.rb +2 -2
  75. data/lib/zakuro/gateway/locale/range.rb +3 -3
  76. data/lib/zakuro/gateway/range.rb +1 -1
  77. data/lib/zakuro/gateway/single.rb +13 -2
  78. data/lib/zakuro/merchant.rb +1 -1
  79. data/lib/zakuro/operation/month/parser.rb +252 -251
  80. data/lib/zakuro/operation/month/type.rb +17 -8
  81. data/lib/zakuro/operation/month/validator.rb +148 -144
  82. data/lib/zakuro/operation/operation.rb +38 -36
  83. data/lib/zakuro/output/response.rb +112 -113
  84. data/lib/zakuro/result/operation/month/annotation.rb +2 -2
  85. data/lib/zakuro/result/operation/month/history.rb +2 -2
  86. data/lib/zakuro/result/operation/month.rb +31 -0
  87. data/lib/zakuro/result/operation.rb +39 -0
  88. data/lib/zakuro/result/result.rb +3 -3
  89. data/lib/zakuro/tools/stringifier.rb +66 -64
  90. data/lib/zakuro/tools/typeconv.rb +17 -15
  91. data/lib/zakuro/tools/typeof.rb +15 -13
  92. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
  93. data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
  94. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -39
  95. data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
  96. data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -49
  97. data/lib/zakuro/version/daien/stella/origin/average_november.rb +15 -13
  98. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +23 -21
  99. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +22 -20
  100. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +12 -10
  101. data/lib/zakuro/version/daien/stella/solar/average.rb +53 -51
  102. data/lib/zakuro/version/daien/stella/solar/interval.rb +19 -17
  103. data/lib/zakuro/version/daien/stella/solar/value.rb +13 -11
  104. data/lib/zakuro/version/genka/cycle/remainder.rb +2 -2
  105. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
  106. data/lib/zakuro/version/genka/range/annual_range.rb +48 -44
  107. data/lib/zakuro/version/genka/stella/origin/first_term.rb +30 -28
  108. data/lib/zakuro/version/genka/stella/origin/january.rb +22 -20
  109. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
  110. data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
  111. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -39
  112. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
  113. data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -49
  114. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +15 -13
  115. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +23 -21
  116. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +24 -22
  117. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +12 -10
  118. data/lib/zakuro/version/gihou/stella/solar/average.rb +52 -50
  119. data/lib/zakuro/version/gihou/stella/solar/interval.rb +19 -17
  120. data/lib/zakuro/version/gihou/stella/solar/value.rb +13 -11
  121. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +10 -10
  122. data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
  123. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -38
  124. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
  125. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -36
  126. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +15 -13
  127. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +23 -21
  128. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +22 -20
  129. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +12 -10
  130. data/lib/zakuro/version/senmyou/stella/solar/average.rb +52 -50
  131. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +19 -17
  132. data/lib/zakuro/version/senmyou/stella/solar/value.rb +13 -11
  133. metadata +12 -9
  134. data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -218
  135. data/lib/zakuro/result/operation/bundle.rb +0 -44
  136. data/lib/zakuro/result/operation/month/bundle.rb +0 -36
@@ -20,122 +20,124 @@ module Zakuro
20
20
  EMPTY_STRING = '-'
21
21
  BOOLEANS = %w[true false].freeze
22
22
 
23
- #
24
- # 有効文字列か
25
- #
26
- # @param [String] str 対象文字列
27
- #
28
- # @return [True] 有効
29
- # @return [False] 無効
30
- #
31
- def self.string?(str: '')
32
- return false if str == ''
23
+ class << self
24
+ #
25
+ # 有効文字列か
26
+ #
27
+ # @param [String] str 対象文字列
28
+ #
29
+ # @return [True] 有効
30
+ # @return [False] 無効
31
+ #
32
+ def string?(str: '')
33
+ return false if str == ''
33
34
 
34
- return false unless str
35
+ return false unless str
35
36
 
36
- str.is_a?(String)
37
- end
37
+ str.is_a?(String)
38
+ end
38
39
 
39
- #
40
- # 有効文字列(空文字許容)か
41
- #
42
- # @param [String] str 対象文字列
43
- #
44
- # @return [True] 有効
45
- # @return [False] 無効
46
- #
47
- def self.empiable_string?(str: '')
48
- return false unless str
40
+ #
41
+ # 有効文字列(空文字許容)か
42
+ #
43
+ # @param [String] str 対象文字列
44
+ #
45
+ # @return [True] 有効
46
+ # @return [False] 無効
47
+ #
48
+ def empiable_string?(str: '')
49
+ return false unless str
49
50
 
50
- str.is_a?(String)
51
- end
51
+ str.is_a?(String)
52
+ end
52
53
 
53
- #
54
- # 正数か
55
- #
56
- # @param [String] str 対象文字列
57
- #
58
- # @return [True] 正数
59
- # @return [False] 負数
60
- #
61
- def self.positive?(str: '')
62
- return true if str == EMPTY_STRING
54
+ #
55
+ # 正数か
56
+ #
57
+ # @param [String] str 対象文字列
58
+ #
59
+ # @return [True] 正数
60
+ # @return [False] 負数
61
+ #
62
+ def positive?(str: '')
63
+ return true if str == EMPTY_STRING
63
64
 
64
- return false unless str
65
+ return false unless str
65
66
 
66
- /^[0-9]+$/.match?(str)
67
- end
67
+ /^[0-9]+$/.match?(str)
68
+ end
68
69
 
69
- #
70
- # 数値か
71
- #
72
- # @param [String] str 対象文字列
73
- #
74
- # @return [True] 数値
75
- # @return [False] 非数値
76
- #
77
- def self.num?(str: '')
78
- return true if str == EMPTY_STRING
70
+ #
71
+ # 数値か
72
+ #
73
+ # @param [String] str 対象文字列
74
+ #
75
+ # @return [True] 数値
76
+ # @return [False] 非数値
77
+ #
78
+ def num?(str: '')
79
+ return true if str == EMPTY_STRING
79
80
 
80
- return false unless str
81
+ return false unless str
81
82
 
82
- /^[-0-9]+$/.match?(str)
83
- end
83
+ /^[-0-9]+$/.match?(str)
84
+ end
84
85
 
85
- #
86
- # booleanか
87
- #
88
- # @param [String] str 対象文字列
89
- #
90
- # @return [True] boolean
91
- # @return [False] 非boolean
92
- #
93
- def self.bool?(str: '')
94
- BOOLEANS.include?(str)
95
- end
86
+ #
87
+ # booleanか
88
+ #
89
+ # @param [String] str 対象文字列
90
+ #
91
+ # @return [True] boolean
92
+ # @return [False] 非boolean
93
+ #
94
+ def bool?(str: '')
95
+ BOOLEANS.include?(str)
96
+ end
96
97
 
97
- #
98
- # boolean(空許容)か
99
- #
100
- # @param [String] str 対象文字列
101
- #
102
- # @return [True] boolean
103
- # @return [False] 非boolean
104
- #
105
- def self.empiable_bool?(str: '')
106
- return true if str == EMPTY_STRING
98
+ #
99
+ # boolean(空許容)か
100
+ #
101
+ # @param [String] str 対象文字列
102
+ #
103
+ # @return [True] boolean
104
+ # @return [False] 非boolean
105
+ #
106
+ def empiable_bool?(str: '')
107
+ return true if str == EMPTY_STRING
107
108
 
108
- bool?(str: str)
109
- end
109
+ bool?(str: str)
110
+ end
110
111
 
111
- #
112
- # 月差分か
113
- #
114
- # @param [String] str 対象文字列
115
- #
116
- # @return [True] 有効
117
- # @return [False] 無効
118
- #
119
- def self.month_days?(str: '')
120
- return true if str == EMPTY_STRING
112
+ #
113
+ # 月差分か
114
+ #
115
+ # @param [String] str 対象文字列
116
+ #
117
+ # @return [True] 有効
118
+ # @return [False] 無効
119
+ #
120
+ def month_days?(str: '')
121
+ return true if str == EMPTY_STRING
121
122
 
122
- return false unless str
123
+ return false unless str
123
124
 
124
- /^[大小]$/.match?(str)
125
- end
125
+ /^[大小]$/.match?(str)
126
+ end
126
127
 
127
- #
128
- # 西暦日か
129
- #
130
- # @param [String] str 対象文字列
131
- #
132
- # @return [True] 有効
133
- # @return [False] 無効
134
- #
135
- def self.western_date?(str: '')
136
- return Western::Calendar.new if str == EMPTY_STRING
128
+ #
129
+ # 西暦日か
130
+ #
131
+ # @param [String] str 対象文字列
132
+ #
133
+ # @return [True] 有効
134
+ # @return [False] 無効
135
+ #
136
+ def western_date?(str: '')
137
+ return Western::Calendar.new if str == EMPTY_STRING
137
138
 
138
- Western::Calendar.valid_date_string(text: str)
139
+ Western::Calendar.valid_date_string(text: str)
140
+ end
139
141
  end
140
142
  end
141
143
 
@@ -381,9 +383,9 @@ module Zakuro
381
383
 
382
384
  prefix = "[#{@index}] invalid"
383
385
 
384
- failed += @month.validate
386
+ failed += month.validate
385
387
 
386
- failed += @solar_term.validate
388
+ failed += solar_term.validate
387
389
 
388
390
  failed.push("#{prefix} 'days'. #{@days}") unless days?
389
391
 
@@ -432,11 +434,11 @@ module Zakuro
432
434
  def validate
433
435
  failed = []
434
436
 
435
- failed += @number.validate
437
+ failed += number.validate
436
438
 
437
- failed += @leaped.validate
439
+ failed += leaped.validate
438
440
 
439
- failed += @days.validate
441
+ failed += days.validate
440
442
 
441
443
  failed
442
444
  end
@@ -473,7 +475,7 @@ module Zakuro
473
475
  end
474
476
 
475
477
  def days?
476
- Types.positive?(str: @days)
478
+ Types.positive?(str: days)
477
479
  end
478
480
 
479
481
  # :reek:TooManyStatements { max_statements: 6 }
@@ -488,9 +490,9 @@ module Zakuro
488
490
 
489
491
  prefix = "[#{index}][solar_term] invalid"
490
492
 
491
- failed += @source.validate
493
+ failed += source.validate
492
494
 
493
- failed += @destination.validate
495
+ failed += destination.validate
494
496
 
495
497
  failed.push("#{prefix} 'days'. #{@days}") unless days?
496
498
 
@@ -537,27 +539,27 @@ module Zakuro
537
539
  def validate
538
540
  failed = []
539
541
 
540
- prefix = "[#{@diff_index}][solar_term.src] invalid"
542
+ prefix = "[#{diff_index}][solar_term.src] invalid"
541
543
 
542
- failed.push("#{prefix} 'index'. #{@index}") unless index?
544
+ failed.push("#{prefix} 'index'. #{index}") unless index?
543
545
 
544
- failed.push("#{prefix} 'to'. #{@to}") unless to?
546
+ failed.push("#{prefix} 'to'. #{to}") unless to?
545
547
 
546
- failed.push("#{prefix} 'zodiac_name'. #{@zodiac_name}") unless zodiac_name?
548
+ failed.push("#{prefix} 'zodiac_name'. #{zodiac_name}") unless zodiac_name?
547
549
 
548
550
  failed
549
551
  end
550
552
 
551
553
  def index?
552
- Types.positive?(str: @index)
554
+ Types.positive?(str: index)
553
555
  end
554
556
 
555
557
  def to?
556
- Types.western_date?(str: @to)
558
+ Types.western_date?(str: to)
557
559
  end
558
560
 
559
561
  def zodiac_name?
560
- Types.string?(str: @zodiac_name)
562
+ Types.string?(str: zodiac_name)
561
563
  end
562
564
  end
563
565
 
@@ -600,27 +602,27 @@ module Zakuro
600
602
  def validate
601
603
  failed = []
602
604
 
603
- prefix = "[#{@diff_index}][solar_term.dest] invalid"
605
+ prefix = "[#{diff_index}][solar_term.dest] invalid"
604
606
 
605
- failed.push("#{prefix} 'index'. #{@index}") unless index?
607
+ failed.push("#{prefix} 'index'. #{index}") unless index?
606
608
 
607
- failed.push("#{prefix} 'from'. #{@from}") unless from?
609
+ failed.push("#{prefix} 'from'. #{from}") unless from?
608
610
 
609
- failed.push("#{prefix} 'zodiac_name'. #{@zodiac_name}") unless zodiac_name?
611
+ failed.push("#{prefix} 'zodiac_name'. #{zodiac_name}") unless zodiac_name?
610
612
 
611
613
  failed
612
614
  end
613
615
 
614
616
  def index?
615
- Types.positive?(str: @index)
617
+ Types.positive?(str: index)
616
618
  end
617
619
 
618
620
  def from?
619
- Types.western_date?(str: @from)
621
+ Types.western_date?(str: from)
620
622
  end
621
623
 
622
624
  def zodiac_name?
623
- Types.string?(str: @zodiac_name)
625
+ Types.string?(str: zodiac_name)
624
626
  end
625
627
  end
626
628
  end
@@ -660,21 +662,21 @@ module Zakuro
660
662
  def validate
661
663
  failed = []
662
664
 
663
- prefix = "[#{@index}][#{NAME}] invalid"
665
+ prefix = "[#{index}][#{NAME}] invalid"
664
666
 
665
- failed.push("#{prefix} 'src'. #{@src}") unless src?
667
+ failed.push("#{prefix} 'src'. #{src}") unless src?
666
668
 
667
- failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
669
+ failed.push("#{prefix} 'dest'. #{dest}") unless dest?
668
670
 
669
671
  failed
670
672
  end
671
673
 
672
674
  def src?
673
- Types.positive?(str: @src)
675
+ Types.positive?(str: src)
674
676
  end
675
677
 
676
678
  def dest?
677
- Types.positive?(str: @dest)
679
+ Types.positive?(str: dest)
678
680
  end
679
681
  end
680
682
 
@@ -713,21 +715,21 @@ module Zakuro
713
715
  def validate
714
716
  failed = []
715
717
 
716
- prefix = "[#{@index}][#{NAME}] invalid"
718
+ prefix = "[#{index}][#{NAME}] invalid"
717
719
 
718
- failed.push("#{prefix} 'src'. #{@src}") unless src?
720
+ failed.push("#{prefix} 'src'. #{src}") unless src?
719
721
 
720
- failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
722
+ failed.push("#{prefix} 'dest'. #{dest}") unless dest?
721
723
 
722
724
  failed
723
725
  end
724
726
 
725
727
  def src?
726
- Types.empiable_bool?(str: @src)
728
+ Types.empiable_bool?(str: src)
727
729
  end
728
730
 
729
731
  def dest?
730
- Types.empiable_bool?(str: @dest)
732
+ Types.empiable_bool?(str: dest)
731
733
  end
732
734
  end
733
735
 
@@ -766,36 +768,38 @@ module Zakuro
766
768
  def validate
767
769
  failed = []
768
770
 
769
- prefix = "[#{@index}][#{NAME}] invalid"
771
+ prefix = "[#{index}][#{NAME}] invalid"
770
772
 
771
- failed.push("#{prefix} 'src'. #{@src}") unless src?
773
+ failed.push("#{prefix} 'src'. #{src}") unless src?
772
774
 
773
- failed.push("#{prefix} 'dest'. #{@dest}") unless dest?
775
+ failed.push("#{prefix} 'dest'. #{dest}") unless dest?
774
776
 
775
777
  failed
776
778
  end
777
779
 
778
780
  def src?
779
- Types.month_days?(str: @src)
781
+ Types.month_days?(str: src)
780
782
  end
781
783
 
782
784
  def dest?
783
- Types.month_days?(str: @dest)
785
+ Types.month_days?(str: dest)
784
786
  end
785
787
  end
786
788
 
787
789
  # :reek:TooManyStatements { max_statements: 7 }
788
790
 
789
- def self.run(yaml_hash: {})
790
- failed = []
791
- yaml_hash.each_with_index do |history, index|
792
- failed += MonthHistory.new(index: index, yaml_hash: history).validate
793
- failed += Annotation.new(index: index, yaml_hash: history).validate
794
- failed += Reference.new(index: index, yaml_hash: history).validate
795
- failed += Diffs.new(index: index, yaml_hash: history['diffs']).validate
796
- end
791
+ class << self
792
+ def run(yaml_hash: {})
793
+ failed = []
794
+ yaml_hash.each_with_index do |history, index|
795
+ failed += MonthHistory.new(index: index, yaml_hash: history).validate
796
+ failed += Annotation.new(index: index, yaml_hash: history).validate
797
+ failed += Reference.new(index: index, yaml_hash: history).validate
798
+ failed += Diffs.new(index: index, yaml_hash: history['diffs']).validate
799
+ end
797
800
 
798
- failed
801
+ failed
802
+ end
799
803
  end
800
804
  end
801
805
  end
@@ -16,51 +16,53 @@ module Zakuro
16
16
  __dir__
17
17
  ))
18
18
 
19
- #
20
- # 変更履歴(月)を返す
21
- #
22
- # @return [Array<MonthHistory>] 変更履歴
23
- #
24
- def self.month_histories
25
- MONTH_HISTORIES
26
- end
19
+ class << self
20
+ #
21
+ # 変更履歴(月)を返す
22
+ #
23
+ # @return [Array<MonthHistory>] 変更履歴
24
+ #
25
+ def month_histories
26
+ MONTH_HISTORIES
27
+ end
27
28
 
28
- # :reek:ControlParameter
29
+ # :reek:ControlParameter
29
30
 
30
- #
31
- # 変更履歴を特定する
32
- #
33
- # @param [Western::Calendar] western_date 月初日の西暦日
34
- #
35
- # @return [Operation::MonthHistory] 変更履歴
36
- #
37
- def self.specify_history(western_date:)
38
- month_histroies = Operation.month_histories
31
+ #
32
+ # 変更履歴を特定する
33
+ #
34
+ # @param [Western::Calendar] western_date 月初日の西暦日
35
+ #
36
+ # @return [Operation::MonthHistory] 変更履歴
37
+ #
38
+ def specify_history(western_date:)
39
+ month_histroies = month_histories
40
+
41
+ month_histroies.each do |history|
42
+ return history if western_date == history.western_date
43
+ end
39
44
 
40
- month_histroies.each do |history|
41
- return history if western_date == history.western_date
45
+ Operation::MonthHistory.new
42
46
  end
43
47
 
44
- Operation::MonthHistory.new
45
- end
48
+ # :reek:ControlParameter
46
49
 
47
- # :reek:ControlParameter
50
+ #
51
+ # 変更履歴を特定する
52
+ #
53
+ # @param [Western::Calendar] id 変更履歴ID
54
+ #
55
+ # @return [Operation::MonthHistory] 変更履歴
56
+ #
57
+ def specify_history_by_id(id:)
58
+ month_histroies = month_histories
48
59
 
49
- #
50
- # 変更履歴を特定する
51
- #
52
- # @param [Western::Calendar] id 変更履歴ID
53
- #
54
- # @return [Operation::MonthHistory] 変更履歴
55
- #
56
- def self.specify_history_by_id(id:)
57
- month_histroies = Operation.month_histories
60
+ month_histroies.each do |history|
61
+ return history if id == history.id
62
+ end
58
63
 
59
- month_histroies.each do |history|
60
- return history if id == history.id
64
+ Operation::MonthHistory.new
61
65
  end
62
-
63
- Operation::MonthHistory.new
64
66
  end
65
67
  end
66
68
  end