zakuro 0.9.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +41 -8
  4. data/VERSION +1 -1
  5. data/doc/gengou.md +1 -1
  6. data/doc/operation/csv/month.csv +5 -5
  7. data/doc/operation/operation.xlsx +0 -0
  8. data/images/logo-text.png +0 -0
  9. data/lib/zakuro/calculation/base/gengou.rb +2 -4
  10. data/lib/zakuro/calculation/base/year.rb +1 -1
  11. data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +2 -2
  12. data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
  13. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +4 -4
  14. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
  15. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +1 -1
  16. data/lib/zakuro/calculation/era/version/internal/crawler.rb +3 -3
  17. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +1 -1
  18. data/lib/zakuro/calculation/monthly/internal/date_comparer.rb +78 -0
  19. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/all_solar_term.rb +1 -1
  20. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/meta_collector.rb +2 -2
  21. data/lib/zakuro/calculation/monthly/{first_day.rb → internal/part/first_day.rb} +2 -2
  22. data/lib/zakuro/calculation/monthly/{meta.rb → internal/part/meta.rb} +1 -1
  23. data/lib/zakuro/calculation/monthly/internal/solar_term_selector.rb +203 -0
  24. data/lib/zakuro/calculation/monthly/month.rb +30 -125
  25. data/lib/zakuro/calculation/monthly/operated_month.rb +5 -2
  26. data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
  27. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +24 -10
  28. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +3 -3
  29. data/lib/zakuro/calculation/summary/internal/option/dropped_date.rb +102 -0
  30. data/lib/zakuro/calculation/summary/internal/option/vanished_date.rb +111 -0
  31. data/lib/zakuro/calculation/summary/internal/option.rb +4 -137
  32. data/lib/zakuro/calculation/summary/japan/range.rb +4 -5
  33. data/lib/zakuro/calculation/summary/western/single.rb +0 -2
  34. data/lib/zakuro/context/version_class_resolver.rb +5 -5
  35. data/lib/zakuro/era/japan/calendar.rb +4 -4
  36. data/lib/zakuro/era/japan/gengou/alignment/division.rb +2 -2
  37. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +2 -2
  38. data/lib/zakuro/era/japan/gengou/alignment.rb +5 -3
  39. data/lib/zakuro/era/japan/gengou/resource/parser.rb +17 -16
  40. data/lib/zakuro/era/japan/gengou/resource/validator.rb +3 -394
  41. data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +2 -2
  42. data/lib/zakuro/era/japan/gengou.rb +3 -3
  43. data/lib/zakuro/era/japan/type/base/both/date.rb +51 -0
  44. data/lib/zakuro/era/japan/type/base/both/year.rb +53 -0
  45. data/lib/zakuro/era/japan/type/base/gengou.rb +177 -0
  46. data/lib/zakuro/era/japan/type/base/gengou_set.rb +78 -0
  47. data/lib/zakuro/era/japan/type/base/switch_date.rb +74 -0
  48. data/lib/zakuro/era/japan/type/base/version_range.rb +189 -0
  49. data/lib/zakuro/era/japan/type/validation/both/date.rb +99 -0
  50. data/lib/zakuro/era/japan/type/validation/both/year.rb +75 -0
  51. data/lib/zakuro/era/japan/type/validation/gengou.rb +93 -0
  52. data/lib/zakuro/era/japan/type/validation/gengou_set.rb +133 -0
  53. data/lib/zakuro/era/japan/type/validation/switch_date.rb +73 -0
  54. data/lib/zakuro/era/japan/type/validation/version_range.rb +109 -0
  55. data/lib/zakuro/era/japan/type/validation/version_root.rb +102 -0
  56. data/lib/zakuro/era/japan/version/resource/parser.rb +266 -0
  57. data/lib/zakuro/era/japan/version/resource/validator.rb +37 -0
  58. data/lib/zakuro/era/japan/version/resource/yaml/version.yaml +80 -0
  59. data/lib/zakuro/era/japan/version/resource.rb +22 -0
  60. data/lib/zakuro/era/japan/version.rb +4 -115
  61. data/lib/zakuro/era/western/calendar.rb +2 -2
  62. data/lib/zakuro/exception/zakuro_error.rb +1 -1
  63. data/lib/zakuro/merchant.rb +5 -5
  64. data/lib/zakuro/operation/month/parser.rb +2 -2
  65. data/lib/zakuro/operation/yaml/month.yaml +5 -5
  66. data/lib/zakuro/output/logger.rb +4 -4
  67. data/lib/zakuro/parameter/catalog/basis_date.rb +55 -0
  68. data/lib/zakuro/parameter/catalog/column.rb +57 -0
  69. data/lib/zakuro/parameter/catalog/option.rb +60 -0
  70. data/lib/zakuro/parameter/catalog/range.rb +81 -0
  71. data/lib/zakuro/parameter/condition.rb +108 -0
  72. data/lib/zakuro/result/core.rb +2 -2
  73. data/lib/zakuro/{tools → tool}/remainder_comparer.rb +2 -4
  74. data/lib/zakuro/{tools → tool}/stringifier.rb +3 -3
  75. data/lib/zakuro/{tools → tool}/typeconv.rb +2 -2
  76. data/lib/zakuro/{tools → tool}/typeof.rb +2 -2
  77. data/lib/zakuro/version/daien/const/number.rb +42 -39
  78. data/lib/zakuro/version/daien/const/remainder.rb +38 -35
  79. data/lib/zakuro/version/daien/cycle/remainder.rb +77 -74
  80. data/lib/zakuro/version/daien/cycle/solar_term.rb +18 -15
  81. data/lib/zakuro/version/daien/daien.rb +8 -5
  82. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +67 -64
  83. data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +15 -12
  84. data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +15 -12
  85. data/lib/zakuro/version/daien/range/annual_range.rb +27 -24
  86. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +209 -206
  87. data/lib/zakuro/version/daien/stella/lunar/localization.rb +32 -29
  88. data/lib/zakuro/version/daien/stella/lunar/location.rb +53 -50
  89. data/lib/zakuro/version/daien/stella/lunar/value.rb +65 -62
  90. data/lib/zakuro/version/daien/stella/origin/average_november.rb +23 -20
  91. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +42 -39
  92. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +44 -41
  93. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +74 -71
  94. data/lib/zakuro/version/daien/stella/solar/average.rb +68 -65
  95. data/lib/zakuro/version/daien/stella/solar/interval.rb +95 -92
  96. data/lib/zakuro/version/daien/stella/solar/location.rb +41 -38
  97. data/lib/zakuro/version/daien/stella/solar/value.rb +21 -18
  98. data/lib/zakuro/version/genka/const/number.rb +31 -28
  99. data/lib/zakuro/version/genka/const/remainder.rb +20 -17
  100. data/lib/zakuro/version/genka/cycle/remainder.rb +72 -69
  101. data/lib/zakuro/version/genka/cycle/solar_term.rb +18 -15
  102. data/lib/zakuro/version/genka/genka.rb +8 -5
  103. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +82 -79
  104. data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +13 -10
  105. data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +13 -10
  106. data/lib/zakuro/version/genka/range/annual_range.rb +57 -54
  107. data/lib/zakuro/version/genka/stella/origin/first_term.rb +44 -41
  108. data/lib/zakuro/version/genka/stella/origin/january.rb +38 -35
  109. data/lib/zakuro/version/genka/stella/solar/average.rb +24 -21
  110. data/lib/zakuro/version/gihou/const/number.rb +40 -37
  111. data/lib/zakuro/version/gihou/const/remainder.rb +32 -29
  112. data/lib/zakuro/version/gihou/cycle/remainder.rb +38 -35
  113. data/lib/zakuro/version/gihou/cycle/solar_term.rb +18 -15
  114. data/lib/zakuro/version/gihou/gihou.rb +8 -5
  115. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +68 -65
  116. data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +13 -10
  117. data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +13 -10
  118. data/lib/zakuro/version/gihou/range/annual_range.rb +27 -24
  119. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +212 -209
  120. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +32 -29
  121. data/lib/zakuro/version/gihou/stella/lunar/location.rb +53 -50
  122. data/lib/zakuro/version/gihou/stella/lunar/value.rb +65 -62
  123. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +23 -20
  124. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +42 -39
  125. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +44 -41
  126. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +74 -71
  127. data/lib/zakuro/version/gihou/stella/solar/average.rb +67 -64
  128. data/lib/zakuro/version/gihou/stella/solar/interval.rb +95 -92
  129. data/lib/zakuro/version/gihou/stella/solar/location.rb +41 -38
  130. data/lib/zakuro/version/gihou/stella/solar/value.rb +21 -18
  131. data/lib/zakuro/version/gregorio/gregorio.rb +8 -5
  132. data/lib/zakuro/version/houryaku/houryaku.rb +8 -5
  133. data/lib/zakuro/version/joukyou/joukyou.rb +8 -5
  134. data/lib/zakuro/version/kansei/kansei.rb +8 -5
  135. data/lib/zakuro/version/senmyou/const/number.rb +40 -37
  136. data/lib/zakuro/version/senmyou/const/remainder.rb +35 -32
  137. data/lib/zakuro/version/senmyou/cycle/remainder.rb +74 -71
  138. data/lib/zakuro/version/senmyou/cycle/solar_term.rb +18 -15
  139. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +69 -66
  140. data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +15 -12
  141. data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +15 -12
  142. data/lib/zakuro/version/senmyou/range/annual_range.rb +27 -24
  143. data/lib/zakuro/version/senmyou/senmyou.rb +8 -5
  144. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +206 -203
  145. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +32 -29
  146. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +60 -57
  147. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -63
  148. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +23 -20
  149. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +42 -39
  150. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +44 -41
  151. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +74 -71
  152. data/lib/zakuro/version/senmyou/stella/solar/average.rb +67 -64
  153. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +93 -90
  154. data/lib/zakuro/version/senmyou/stella/solar/location.rb +41 -38
  155. data/lib/zakuro/version/senmyou/stella/solar/value.rb +23 -20
  156. data/lib/zakuro/version/tenpou/tenpou.rb +8 -5
  157. metadata +44 -20
  158. data/lib/zakuro/condition.rb +0 -306
  159. data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
  160. data/lib/zakuro/tools/gengou_range_comparer.rb +0 -82
  161. /data/lib/zakuro/calculation/monthly/{operated_solar_term.rb → internal/operated_solar_term.rb} +0 -0
  162. /data/lib/zakuro/calculation/monthly/{const.rb → internal/part/const.rb} +0 -0
  163. /data/lib/zakuro/calculation/monthly/{month_label.rb → internal/part/month_label.rb} +0 -0
@@ -36,7 +36,7 @@ module Zakuro
36
36
  def debug(*messages)
37
37
  return if none?
38
38
 
39
- return if LEVEL >= LEVELS[:debug]
39
+ return if LEVELS[:debug] < LEVEL
40
40
 
41
41
  output('DEBUG', *messages)
42
42
  end
@@ -49,7 +49,7 @@ module Zakuro
49
49
  def info(*messages)
50
50
  return if none?
51
51
 
52
- return if LEVEL >= LEVELS[:info]
52
+ return if LEVELS[:info] < LEVEL
53
53
 
54
54
  output('INFO', *messages)
55
55
  end
@@ -63,7 +63,7 @@ module Zakuro
63
63
  def error(error, *messages)
64
64
  return if none?
65
65
 
66
- return if LEVEL >= LEVELS[:error]
66
+ return if LEVELS[:error] < LEVEL
67
67
 
68
68
  output('ERROR', *messages)
69
69
  output('ERROR', error.message)
@@ -79,7 +79,7 @@ module Zakuro
79
79
  # @return [False] 出力あり
80
80
  #
81
81
  def none?
82
- LEVEL < LEVELS[:debug]
82
+ LEVELS[:debug] >= LEVEL
83
83
  end
84
84
 
85
85
  #
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../exception/exception'
4
+
5
+ require 'date'
6
+
7
+ # :nodoc:
8
+ module Zakuro
9
+ # :nodoc:
10
+ module Parameter
11
+ # :nodoc:
12
+ module Catalog
13
+ #
14
+ # BasisDate 基準日
15
+ #
16
+ class BasisDate
17
+ # @return [Date] 西暦日
18
+ attr_reader :date
19
+
20
+ #
21
+ # 初期化
22
+ #
23
+ # @param [Date, String] date 西暦日/和暦日
24
+ #
25
+ def initialize(date:)
26
+ @date = date
27
+ end
28
+
29
+ class << self
30
+ #
31
+ # 検証する
32
+ #
33
+ # @param [Date] date 日付
34
+ #
35
+ # @return [Array<Exception::Case::Preset>] エラープリセット配列
36
+ #
37
+ def validate(date:)
38
+ failed = []
39
+ return failed unless date
40
+
41
+ return failed if date.is_a?(Date) || date.is_a?(String)
42
+
43
+ failed.push(
44
+ Exception::Case::Preset.new(
45
+ date.class,
46
+ template: Exception::Case::Pattern::INVALID_DATE_TYPE
47
+ )
48
+ )
49
+ failed
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../exception/exception'
4
+
5
+ # :nodoc:
6
+ module Zakuro
7
+ # :nodoc:
8
+ module Parameter
9
+ # :nodoc:
10
+ module Catalog
11
+ #
12
+ # Column 特定の列(フィールド)
13
+ # @note 指定された列のみ出力する
14
+ #
15
+ class Column
16
+ # @return [Array<String>] 列
17
+ attr_reader :columns
18
+
19
+ #
20
+ # 初期化
21
+ #
22
+ # @param [Array<String>] columns 列
23
+ #
24
+ def initialize(columns: [])
25
+ @columns = columns
26
+ end
27
+
28
+ class << self
29
+ #
30
+ # 検証する
31
+ #
32
+ # @param [Array<String>] columns 列
33
+ #
34
+ # @return [Array<Exception::Case::Preset>] エラープリセット配列
35
+ #
36
+ def validate(columns:)
37
+ # TODO: 列内容のバリデーション
38
+ failed = []
39
+
40
+ return failed unless columns
41
+
42
+ return failed if columns.is_a?(Array)
43
+
44
+ failed.push(
45
+ Exception::Case::Preset.new(
46
+ hash.class,
47
+ template: Exception::Case::Pattern::INVALID_COLUMN_TYPE
48
+ )
49
+ )
50
+
51
+ failed
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../exception/exception'
4
+
5
+ # :nodoc:
6
+ module Zakuro
7
+ # :nodoc:
8
+ module Parameter
9
+ # :nodoc:
10
+ module Catalog
11
+ #
12
+ # Option オプション
13
+ # 取得内容を変更する
14
+ #
15
+ # * version: 暦
16
+ # * dropped_days: 没日あり
17
+ # * seasons: 四季あり
18
+ #
19
+ class Option
20
+ # @return [Array<String>] オプション
21
+ attr_reader :options
22
+
23
+ #
24
+ # 初期化
25
+ #
26
+ # @param [Hash<Symbol, Object>] options オプション
27
+ #
28
+ def initialize(options: [])
29
+ @options = options
30
+ end
31
+
32
+ # TODO: オプションキーのバリデーション
33
+
34
+ class << self
35
+ #
36
+ # 検証する
37
+ #
38
+ # @param [Hash<Symbol, Object>] options オプション
39
+ #
40
+ # @return [Array<Exception::Case::Preset>] エラープリセット配列
41
+ #
42
+ def validate(options:)
43
+ failed = []
44
+ return failed unless options
45
+
46
+ return failed if options.is_a?(Hash)
47
+
48
+ failed.push(
49
+ Exception::Case::Preset.new(
50
+ hash.class,
51
+ template: Exception::Case::Pattern::INVALID_OPTION_TYPE
52
+ )
53
+ )
54
+ failed
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../exception/exception'
4
+
5
+ require_relative './basis_date'
6
+
7
+ # :nodoc:
8
+ module Zakuro
9
+ # :nodoc:
10
+ module Parameter
11
+ # :nodoc:
12
+ module Catalog
13
+ #
14
+ # Range 範囲(開始日-終了日)
15
+ #
16
+ class Range
17
+ # @return [Date] 開始日
18
+ attr_reader :start
19
+ # @return [Date] 終了日
20
+ attr_reader :last
21
+
22
+ #
23
+ # 初期化
24
+ #
25
+ # @param [Hash<Symbol, Object>] hash パラメータ
26
+ # @option hash [Symbol] :start 開始日
27
+ # @option hash [Symbol] :start 終了日
28
+ #
29
+ def initialize(hash: {})
30
+ @start = hash[:start]
31
+ @last = hash[:last]
32
+ end
33
+
34
+ # :reek:TooManyStatements { max_statements: 7 }
35
+
36
+ class << self
37
+ #
38
+ # 検証する
39
+ #
40
+ # @param [Hash<Symbol, Object>] hash パラメータ
41
+ #
42
+ # @return [Array<Exception::Case::Preset>] エラープリセット
43
+ #
44
+ def validate(hash:)
45
+ failed = []
46
+ return failed unless hash
47
+
48
+ unless hash.is_a?(Hash)
49
+ failed.push(
50
+ Exception::Case::Preset.new(
51
+ hash.class,
52
+ template: Exception::Case::Pattern::INVALID_RANGE_TYPE
53
+ )
54
+ )
55
+ return failed
56
+ end
57
+
58
+ failed.concat(BasisDate.validate(date: hash[:start]))
59
+ failed.concat(BasisDate.validate(date: hash[:last]))
60
+
61
+ failed
62
+ end
63
+ end
64
+
65
+ #
66
+ # 不正か
67
+ #
68
+ # @return [True] 不正
69
+ # @return [False] 不正なし
70
+ #
71
+ def invalid?
72
+ return true unless @start
73
+
74
+ return true unless @end
75
+
76
+ false
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../exception/exception'
4
+
5
+ require_relative './catalog/basis_date'
6
+ require_relative './catalog/column'
7
+ require_relative './catalog/option'
8
+ require_relative './catalog/range'
9
+
10
+ # :nodoc:
11
+ module Zakuro
12
+ # :nodoc:
13
+ module Parameter
14
+ #
15
+ # Condition 条件
16
+ #
17
+ class Condition
18
+ # @return [Date] 基準日
19
+ attr_reader :date
20
+ # @return [Hash<Symbol, Date>] 範囲
21
+ attr_reader :range
22
+ # @return [Array<String>] 列
23
+ attr_reader :columns
24
+ # @return [Hash<String, Object>] オプション
25
+ attr_reader :options
26
+
27
+ #
28
+ # 初期化
29
+ #
30
+ # @param [Hash<Symbol, Object>] hash パラメータ
31
+ # @option hash [Date] :date 基準日
32
+ # @option hash [Hash<Symbol, Date>] :range 範囲
33
+ # @option hash [Array<String>] :columns 列
34
+ # @option hash [Hash<String, Object>] :options オプション
35
+ #
36
+ def initialize(hash: {})
37
+ @date = hash[:date]
38
+ @range = hash[:range]
39
+ @columns = hash[:columns]
40
+ @options = hash[:options] || {}
41
+ end
42
+
43
+ #
44
+ # 上書きする
45
+ #
46
+ # @param [Hash<Symbol, Object>] hash パラメータ
47
+ #
48
+ def rewrite(hash: {})
49
+ instance_variables.each do |var|
50
+ key = var.to_s.delete('@')
51
+ val = hash[key.intern]
52
+
53
+ next unless val
54
+
55
+ instance_variable_set(var, val)
56
+ end
57
+ end
58
+
59
+ # :reek:TooManyStatements { max_statements: 8 }
60
+
61
+ class << self
62
+ #
63
+ # 検証する
64
+ #
65
+ # @param [Hash<Symbol, Object>] hash パラメータ
66
+ #
67
+ # @return [Array<Exception::Case::Preset>] エラープリセット配列
68
+ #
69
+ def validate(hash:)
70
+ failed = []
71
+
72
+ unless hash.is_a?(Hash)
73
+ failed.push(
74
+ Exception::Case::Preset.new(
75
+ hash.class,
76
+ template: Exception::Case::Pattern::INVALID_CONDITION_TYPE
77
+ )
78
+ )
79
+ return failed
80
+ end
81
+
82
+ failed.concat(validate_hash(hash: hash))
83
+
84
+ failed
85
+ end
86
+
87
+ private
88
+
89
+ #
90
+ # ハッシュ内を検証する
91
+ #
92
+ # @param [Hash<Symbol, Object>] hash パラメータ
93
+ #
94
+ # @return [Array<Exception::Case::Preset>] エラープリセット配列
95
+ #
96
+ def validate_hash(hash:)
97
+ failed = []
98
+ failed.concat(Catalog::BasisDate.validate(date: hash[:date]))
99
+ failed.concat(Catalog::Range.validate(hash: hash[:range]))
100
+ failed.concat(Catalog::Column.validate(columns: hash[:columns]))
101
+ failed.concat(Catalog::Option.validate(options: hash[:options]))
102
+
103
+ failed
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'json'
4
4
 
5
- require_relative '../tools/stringifier'
5
+ require_relative '../tool/stringifier'
6
6
 
7
7
  # :nodoc:
8
8
  module Zakuro
@@ -25,7 +25,7 @@ module Zakuro
25
25
  # @return [Hash<String, Object>] ハッシュ
26
26
  #
27
27
  def to_h
28
- Tools::Stringifier.to_h(obj: self, class_prefix: 'Zakuro::Result')
28
+ Tool::Stringifier.to_h(obj: self, class_prefix: 'Zakuro::Result')
29
29
  end
30
30
 
31
31
  #
@@ -4,14 +4,12 @@ require_relative '../output/logger'
4
4
 
5
5
  require_relative '../calculation/cycle/abstract_remainder'
6
6
 
7
- # TODO: Tools -> Tool
8
-
9
7
  # :nodoc:
10
8
  module Zakuro
11
9
  #
12
- # Tools 汎用メソッド群
10
+ # Tool 汎用メソッド群
13
11
  #
14
- module Tools
12
+ module Tool
15
13
  #
16
14
  # RemainderComparer 大余小余比較
17
15
  #
@@ -5,9 +5,9 @@ require_relative './typeof'
5
5
  # :nodoc:
6
6
  module Zakuro
7
7
  #
8
- # Tools 汎用メソッド群
8
+ # Tool 汎用メソッド群
9
9
  #
10
- module Tools
10
+ module Tool
11
11
  #
12
12
  # Stringifier 文字列処理
13
13
  #
@@ -48,7 +48,7 @@ module Zakuro
48
48
  return obj unless obj
49
49
 
50
50
  # 日付をフォーマットする
51
- return obj.format if formatted && Tools::Typeof.time?(obj: obj)
51
+ return obj.format if formatted && Tool::Typeof.time?(obj: obj)
52
52
 
53
53
  # 同じモジュール内のオブジェクトは再帰する
54
54
  if obj.class.name.start_with?(class_prefix)
@@ -5,9 +5,9 @@ require_relative '../output/logger'
5
5
  # :nodoc:
6
6
  module Zakuro
7
7
  #
8
- # Tools 汎用メソッド群
8
+ # Tool 汎用メソッド群
9
9
  #
10
- module Tools
10
+ module Tool
11
11
  # :reek:UncommunicativeVariableName {accept: e}
12
12
 
13
13
  #
@@ -7,9 +7,9 @@ require_relative '../era/western/calendar'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  #
10
- # Tools 汎用メソッド群
10
+ # Tool 汎用メソッド群
11
11
  #
12
- module Tools
12
+ module Tool
13
13
  #
14
14
  # Typeof 型判定
15
15
  #
@@ -3,53 +3,56 @@
3
3
  # :nodoc:
4
4
  module Zakuro
5
5
  # :nodoc:
6
- module Daien
7
- #
8
- # Const 定数
9
- #
10
- module Const
6
+ module Version
7
+ # :nodoc:
8
+ module Daien
11
9
  #
12
- # Number 数値
10
+ # Const 定数
13
11
  #
14
- module Number
12
+ module Const
15
13
  #
16
- # Cycle 周期
14
+ # Number 数値
17
15
  #
18
- module Cycle
19
- # @return [Integer] 通法(1日=3040分)
20
- DAY = 3040
16
+ module Number
21
17
  #
22
- # @return [Float] 転日(1近点月 = 27日1685分79秒(1分=80秒))
23
- # @note 小数点以下の値によって大幅に結果が変わる。除算結果を設定した
18
+ # Cycle 周期
24
19
  #
25
- ANOMALISTIC_MONTH = 83_765 + (79.0 / 80)
26
- # @return [Integer] 朔望月
27
- SYNODIC_MONTH = 89_773
28
- # @return [Integer] 一年
29
- YEAR = 1_110_343
30
- end
20
+ module Cycle
21
+ # @return [Integer] 通法(1日=3040分)
22
+ DAY = 3040
23
+ #
24
+ # @return [Float] 転日(1近点月 = 27日1685分79秒(1分=80秒))
25
+ # @note 小数点以下の値によって大幅に結果が変わる。除算結果を設定した
26
+ #
27
+ ANOMALISTIC_MONTH = 83_765 + (79.0 / 80)
28
+ # @return [Integer] 朔望月
29
+ SYNODIC_MONTH = 89_773
30
+ # @return [Integer] 一年
31
+ YEAR = 1_110_343
32
+ end
31
33
 
32
- #
33
- # Derivation 導出
34
- #
35
- module Derivation
36
- # @return [Integer] 通余: (YEAR - DAY * 12 * 30)
37
- # 1110343 - 1094400
38
- REMAINDER_ALL_YEAR = 15_943
39
- # @return [Integer] 旬周(60日) DAY * 60
40
- SIXTY_DAYS = 182_400
41
- # @return [Integer] 朔虚分: (30 * 3040) % (29 * 3040 + 1613)
42
- REMAINDER_IDEAL_MONTH = 1427
43
- end
34
+ #
35
+ # Derivation 導出
36
+ #
37
+ module Derivation
38
+ # @return [Integer] 通余: (YEAR - DAY * 12 * 30)
39
+ # 1110343 - 1094400
40
+ REMAINDER_ALL_YEAR = 15_943
41
+ # @return [Integer] 旬周(60日) DAY * 60
42
+ SIXTY_DAYS = 182_400
43
+ # @return [Integer] 朔虚分: (30 * 3040) % (29 * 3040 + 1613)
44
+ REMAINDER_IDEAL_MONTH = 1427
45
+ end
44
46
 
45
- #
46
- # 累積
47
- #
48
- module Stack
49
- # @return [Integer] 積年(甲子夜半朔旦冬至〜暦の開始前)
50
- TOTAL_YEAR = 96_961_740
51
- # @return [Integer] 暦の開始年(開元12年)
52
- BEGIN_YEAR = 724
47
+ #
48
+ # 累積
49
+ #
50
+ module Stack
51
+ # @return [Integer] 積年(甲子夜半朔旦冬至〜暦の開始前)
52
+ TOTAL_YEAR = 96_961_740
53
+ # @return [Integer] 暦の開始年(開元12年)
54
+ BEGIN_YEAR = 724
55
+ end
53
56
  end
54
57
  end
55
58
  end
@@ -5,52 +5,55 @@ require_relative '../cycle/remainder'
5
5
  # :nodoc:
6
6
  module Zakuro
7
7
  # :nodoc:
8
- module Daien
9
- #
10
- # Const 定数
11
- #
12
- module Const
8
+ module Version
9
+ # :nodoc:
10
+ module Daien
13
11
  #
14
- # Remainder 大余小余
12
+ # Const 定数
15
13
  #
16
- module Remainder
14
+ module Const
17
15
  #
18
- # Solar 太陽
16
+ # Remainder 大余小余
19
17
  #
20
- module Solar
21
- # @return [Remainder] 気策(24分の1年)
22
- # 1年(1_110_343) / 24 / 1日(3040)= 15 余り 664.2916666666642
23
- # * 0.2916666666642 * 24(1分=24秒) = 6.999999999940799 ≒ 7
24
- SOLAR_TERM_AVERAGE = Cycle::Remainder.new(day: 15, minute: 664, second: 7)
18
+ module Remainder
25
19
  #
26
- # @note 揲法 89773 = 29-1613
27
- # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
28
- # * 0.25 * 24(1分=24秒) = 6
20
+ # Solar 太陽
29
21
  #
30
- # @return [Cycle::Remainder] 弦(1分=80秒)
31
- QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
22
+ module Solar
23
+ # @return [Remainder] 気策(24分の1年)
24
+ # 1年(1_110_343) / 24 / 1日(3040)= 15 余り 664.2916666666642
25
+ # * 0.2916666666642 * 24(1分=24秒) = 6.999999999940799 ≒ 7
26
+ SOLAR_TERM_AVERAGE = Cycle::Remainder.new(day: 15, minute: 664, second: 7)
27
+ #
28
+ # @note 揲法 89773 = 29-1613
29
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
30
+ # * 0.25 * 24(1分=24秒) = 6
31
+ #
32
+ # @return [Cycle::Remainder] 弦(1分=80秒)
33
+ QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
32
34
 
33
- # @return [Cycle::Remainder] 有没判定
34
- DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
35
+ # @return [Cycle::Remainder] 有没判定
36
+ DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
35
37
 
36
- # @return [Cycle::Remainder] 有滅判定
37
- VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
38
- end
38
+ # @return [Cycle::Remainder] 有滅判定
39
+ VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
40
+ end
39
41
 
40
- #
41
- # Lunar 月
42
- #
43
- module Lunar
44
- # @return [Cycle::LunarRemainder] 転日(1近点月)
45
- ANOMALISTIC_MONTH = \
46
- Cycle::LunarRemainder.new(day: 27, minute: 1685, second: 79)
47
42
  #
48
- # @note 揲法 89773 = 29-1613
49
- # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
50
- # * 0.25 * 80(1分=80秒) = 20
43
+ # Lunar
51
44
  #
52
- # @return [Cycle::LunarRemainder] 弦(1分=80秒)
53
- QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
45
+ module Lunar
46
+ # @return [Cycle::LunarRemainder] 転日(1近点月)
47
+ ANOMALISTIC_MONTH = \
48
+ Cycle::LunarRemainder.new(day: 27, minute: 1685, second: 79)
49
+ #
50
+ # @note 揲法 89773 = 29-1613
51
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
52
+ # * 0.25 * 80(1分=80秒) = 20
53
+ #
54
+ # @return [Cycle::LunarRemainder] 弦(1分=80秒)
55
+ QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
56
+ end
54
57
  end
55
58
  end
56
59
  end