zakuro 0.7.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -13
  3. data/VERSION +1 -1
  4. data/doc/dropped_date.md +93 -0
  5. data/doc/error.md +45 -0
  6. data/doc/operation/csv/month.csv +100 -79
  7. data/doc/operation/operation.xlsx +0 -0
  8. data/lib/zakuro/calculation/base/day.rb +52 -0
  9. data/lib/zakuro/calculation/base/gengou.rb +5 -5
  10. data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
  11. data/lib/zakuro/calculation/base/operated_year.rb +26 -24
  12. data/lib/zakuro/calculation/base/year.rb +7 -7
  13. data/lib/zakuro/calculation/cycle/abstract_remainder.rb +55 -47
  14. data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +28 -24
  15. data/lib/zakuro/calculation/cycle/zodiac.rb +22 -20
  16. data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +38 -29
  17. data/lib/zakuro/calculation/era/gengou/internal/connector.rb +4 -4
  18. data/lib/zakuro/calculation/era/gengou/internal/counter.rb +16 -16
  19. data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +74 -72
  20. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +16 -16
  21. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +58 -35
  22. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +3 -3
  23. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +111 -113
  24. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +6 -6
  25. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +7 -9
  26. data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +22 -20
  27. data/lib/zakuro/calculation/era/version/internal/crawler.rb +39 -22
  28. data/lib/zakuro/calculation/era/version/version.rb +12 -10
  29. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +13 -9
  30. data/lib/zakuro/calculation/monthly/const.rb +18 -0
  31. data/lib/zakuro/calculation/monthly/initialized_month.rb +40 -38
  32. data/lib/zakuro/calculation/monthly/month.rb +17 -17
  33. data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
  34. data/lib/zakuro/calculation/monthly/operated_month.rb +37 -86
  35. data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
  36. data/lib/zakuro/calculation/option/dropped_date/abstract_parameter.rb +44 -0
  37. data/lib/zakuro/calculation/option/dropped_date/location.rb +135 -0
  38. data/lib/zakuro/calculation/range/abstract_full_range.rb +40 -25
  39. data/lib/zakuro/calculation/range/abstract_operation_range.rb +111 -109
  40. data/lib/zakuro/calculation/range/dated_full_range.rb +1 -1
  41. data/lib/zakuro/calculation/range/dated_operation_range.rb +1 -1
  42. data/lib/zakuro/calculation/range/medieval_annual_range.rb +64 -63
  43. data/lib/zakuro/calculation/range/named_full_range.rb +1 -1
  44. data/lib/zakuro/calculation/range/named_operation_range.rb +1 -1
  45. data/lib/zakuro/calculation/range/operated_solar_term.rb +220 -0
  46. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +32 -29
  47. data/lib/zakuro/calculation/range/transfer/year_boundary.rb +115 -117
  48. data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +1 -1
  49. data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +48 -46
  50. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +31 -26
  51. data/lib/zakuro/calculation/stella/solar/abstract_location.rb +7 -5
  52. data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
  53. data/lib/zakuro/calculation/summary/internal/day.rb +42 -0
  54. data/lib/zakuro/calculation/summary/internal/month.rb +32 -11
  55. data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
  56. data/lib/zakuro/calculation/summary/internal/option.rb +101 -0
  57. data/lib/zakuro/calculation/summary/japan/range.rb +145 -118
  58. data/lib/zakuro/calculation/summary/japan/single.rb +87 -87
  59. data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +57 -50
  60. data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
  61. data/lib/zakuro/calculation/summary/western/range.rb +95 -92
  62. data/lib/zakuro/calculation/summary/western/single.rb +78 -76
  63. data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +123 -119
  64. data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +63 -56
  65. data/lib/zakuro/calculation/type/old_float.rb +2 -2
  66. data/lib/zakuro/calculation/type/optional.rb +46 -0
  67. data/lib/zakuro/condition.rb +142 -92
  68. data/lib/zakuro/context/context.rb +44 -0
  69. data/lib/zakuro/context/option.rb +119 -0
  70. data/lib/zakuro/context/version_class_resolver.rb +112 -0
  71. data/lib/zakuro/era/japan/calendar.rb +35 -33
  72. data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +8 -4
  73. data/lib/zakuro/era/japan/gengou/alignment/division.rb +117 -118
  74. data/lib/zakuro/era/japan/gengou/alignment/line.rb +7 -5
  75. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +20 -14
  76. data/lib/zakuro/era/japan/gengou/alignment.rb +27 -25
  77. data/lib/zakuro/era/japan/gengou/resource/parser.rb +51 -34
  78. data/lib/zakuro/era/japan/gengou/resource/type.rb +45 -37
  79. data/lib/zakuro/era/japan/gengou/resource/validator.rb +34 -32
  80. data/lib/zakuro/era/japan/gengou.rb +28 -26
  81. data/lib/zakuro/era/japan/version.rb +18 -16
  82. data/lib/zakuro/era/western/calendar.rb +104 -88
  83. data/lib/zakuro/exception/case/pattern.rb +39 -3
  84. data/lib/zakuro/exception/case/preset.rb +2 -2
  85. data/lib/zakuro/exception/exception.rb +17 -15
  86. data/lib/zakuro/exception/zakuro_error.rb +19 -1
  87. data/lib/zakuro/gateway/locale/date.rb +2 -2
  88. data/lib/zakuro/gateway/locale/range.rb +3 -3
  89. data/lib/zakuro/gateway/range.rb +3 -3
  90. data/lib/zakuro/gateway/single.rb +14 -3
  91. data/lib/zakuro/merchant.rb +79 -9
  92. data/lib/zakuro/operation/month/parser.rb +252 -249
  93. data/lib/zakuro/operation/month/type.rb +17 -8
  94. data/lib/zakuro/operation/month/validator.rb +148 -144
  95. data/lib/zakuro/operation/operation.rb +38 -36
  96. data/lib/zakuro/operation/yaml/month.yaml +955 -281
  97. data/lib/zakuro/output/response.rb +107 -141
  98. data/lib/zakuro/result/data/option/abstract_option.rb +37 -0
  99. data/lib/zakuro/result/data/option/dropped_date/calculation.rb +47 -0
  100. data/lib/zakuro/result/data/option/dropped_date/option.rb +47 -0
  101. data/lib/zakuro/result/data/option/dropped_date/solar_term.rb +48 -0
  102. data/lib/zakuro/result/data/single_day.rb +9 -1
  103. data/lib/zakuro/result/operation/month/annotation.rb +2 -2
  104. data/lib/zakuro/result/operation/month/history.rb +2 -2
  105. data/lib/zakuro/result/operation/month.rb +31 -0
  106. data/lib/zakuro/result/operation.rb +39 -0
  107. data/lib/zakuro/result/result.rb +3 -3
  108. data/lib/zakuro/tools/stringifier.rb +67 -42
  109. data/lib/zakuro/tools/typeconv.rb +17 -15
  110. data/lib/zakuro/tools/typeof.rb +15 -13
  111. data/lib/zakuro/version/daien/cycle/remainder.rb +2 -2
  112. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
  113. data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +31 -0
  114. data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
  115. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -37
  116. data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
  117. data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -47
  118. data/lib/zakuro/version/daien/stella/origin/average_november.rb +15 -13
  119. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +23 -21
  120. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +22 -20
  121. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +12 -10
  122. data/lib/zakuro/version/daien/stella/solar/average.rb +53 -51
  123. data/lib/zakuro/version/daien/stella/solar/interval.rb +19 -17
  124. data/lib/zakuro/version/daien/stella/solar/value.rb +13 -11
  125. data/lib/zakuro/version/genka/cycle/remainder.rb +4 -4
  126. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
  127. data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +31 -0
  128. data/lib/zakuro/version/genka/range/annual_range.rb +48 -44
  129. data/lib/zakuro/version/genka/stella/origin/first_term.rb +30 -28
  130. data/lib/zakuro/version/genka/stella/origin/january.rb +22 -20
  131. data/lib/zakuro/version/gihou/cycle/remainder.rb +2 -2
  132. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
  133. data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +31 -0
  134. data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
  135. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -37
  136. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
  137. data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -47
  138. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +15 -13
  139. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +23 -21
  140. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +24 -22
  141. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +12 -10
  142. data/lib/zakuro/version/gihou/stella/solar/average.rb +52 -50
  143. data/lib/zakuro/version/gihou/stella/solar/interval.rb +19 -17
  144. data/lib/zakuro/version/gihou/stella/solar/value.rb +13 -11
  145. data/lib/zakuro/version/senmyou/const/remainder.rb +7 -1
  146. data/lib/zakuro/version/senmyou/cycle/remainder.rb +37 -2
  147. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +10 -10
  148. data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +33 -0
  149. data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
  150. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -36
  151. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
  152. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -34
  153. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +15 -13
  154. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +23 -21
  155. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +22 -20
  156. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +12 -10
  157. data/lib/zakuro/version/senmyou/stella/solar/average.rb +52 -50
  158. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +19 -17
  159. data/lib/zakuro/version/senmyou/stella/solar/value.rb +13 -11
  160. metadata +27 -7
  161. data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -218
  162. data/lib/zakuro/result/operation/month/bundle.rb +0 -36
  163. data/lib/zakuro/result/operation/operation.rb +0 -44
  164. data/lib/zakuro/version/context.rb +0 -44
  165. data/lib/zakuro/version/version_class_resolver.rb +0 -74
@@ -14,159 +14,125 @@ module Zakuro
14
14
  # SingleDay 1日データ
15
15
  #
16
16
  module SingleDay
17
- #
18
- # Param 引数
19
- #
20
- class Param
21
- # @return [Year] 年情報(各暦のデータ型)
22
- attr_reader :year
23
- # @return [Month] 月情報(各暦のデータ型)
24
- attr_reader :month
25
- # @return [Western::Calendar] 年月日情報(西暦)
26
- attr_reader :date
27
- # @return [Integer] 日数(月初日から指定日までの日数)
28
- attr_reader :days
29
-
17
+ class << self
30
18
  #
31
- # 初期化
19
+ # 1日データを生成する
32
20
  #
33
- # @param [Year] year 年情報(各暦のデータ型)
34
- # @param [Month] month 月情報(各暦のデータ型)
35
- # @param [Western::Calendar] date 年月日情報(西暦)
36
- # @param [Integer] days 日数(月初日から指定日までの日数)
21
+ # @param [Calculation::Base::Year] year 年情報(各暦のデータ型)
22
+ # @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
23
+ # @param [Calculation::Base::Day] day 日情報
24
+ # @param [Hash<String, Result::Data::Option::AbstractOption>] options オプション
37
25
  #
38
- def initialize(year:, month:, date:, days:)
39
- @year = year
40
- @month = month
41
- @date = date
42
- @days = days
26
+ # @return [Result::Data::SingleDay] 1日データ
27
+ #
28
+ def create(year:, month:, day:, options: {})
29
+ Result::Data::SingleDay.new(
30
+ year: save_year(year: year, month: month, day: day),
31
+ month: save_month(month: month, day: day),
32
+ day: save_day(day: day),
33
+ options: options
34
+ )
43
35
  end
44
- end
45
36
 
46
- #
47
- # 1日データを生成する
48
- #
49
- # @param [Parameter] param 引数
50
- #
51
- # @return [SingleDay] 1日データ
52
- #
53
- def self.save_single_day(param:)
54
- year = param.year
55
- month = param.month
56
- date = param.date
57
- days = param.days
58
- Result::Data::SingleDay.new(
59
- year: save_year(year: year, month: month, date: date),
60
- month: save_month(month: month, date: date, days: days),
61
- day: save_day(month: month, date: date, days: days)
62
- )
63
- end
37
+ private
64
38
 
65
- #
66
- # 年データを保存する
67
- #
68
- # @param [Year] year 年情報(各暦のデータ型)
69
- #
70
- # @return [Result::Year] 年データ
71
- #
72
- def self.save_year(year:, month:, date:)
73
- gengou = month.gengou
74
- first = gengou.match_first_line(date: date)
75
- second = gengou.match_second_line(date: date)
76
- Result::Data::Year.new(
77
- first_gengou:
78
- Result::Data::Gengou.new(name: first.name, number: first.year),
79
- second_gengou:
80
- Result::Data::Gengou.new(name: second.name, number: second.year),
81
- zodiac_name: year.zodiac_name, total_days: year.total_days
82
- )
83
- end
84
- private_class_method :save_year
39
+ #
40
+ # 年データを保存する
41
+ #
42
+ # @param [Calculation::Base::Year] year 年情報(各暦のデータ型)
43
+ # @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
44
+ # @param [Calculation::Base::Day] day 日情報
45
+ #
46
+ # @return [Result::Year] 年データ
47
+ #
48
+ def save_year(year:, month:, day:)
49
+ gengou = month.gengou
50
+ date = day.western_date
51
+ first = gengou.match_first_line(date: date)
52
+ second = gengou.match_second_line(date: date)
53
+ Result::Data::Year.new(
54
+ first_gengou:
55
+ Result::Data::Gengou.new(name: first.name, number: first.year),
56
+ second_gengou:
57
+ Result::Data::Gengou.new(name: second.name, number: second.year),
58
+ zodiac_name: year.zodiac_name, total_days: year.total_days
59
+ )
60
+ end
85
61
 
86
- #
87
- # 月データを保存する
88
- #
89
- # @param [Month] month 月情報(各暦のデータ型)
90
- # @param [Western::Calendar] date 年月日情報(西暦)
91
- # @param [Integer] days 日数(月初日から指定日までの日数)
92
- #
93
- # @return [Result::Month] 月データ
94
- #
95
- def self.save_month(month:, date:, days:)
96
- Result::Data::Month.new(
97
- number: month.number, leaped: month.leaped?, days_name: month.days_name,
98
- first_day: save_first_day(remainder: month.remainder,
99
- date: date, days: days),
100
- odd_solar_terms: save_solar_term(term: month.odd_term),
101
- even_solar_terms: save_solar_term(term: month.even_term)
102
- )
103
- end
104
- private_class_method :save_month
62
+ #
63
+ # 月データを保存する
64
+ #
65
+ # @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
66
+ # @param [Calculation::Base::Day] day 日情報
67
+ #
68
+ # @return [Result::Month] 月データ
69
+ #
70
+ def save_month(month:, day:)
71
+ Result::Data::Month.new(
72
+ number: month.number, leaped: month.leaped?, days_name: month.days_name,
73
+ first_day: save_first_day(remainder: month.remainder,
74
+ date: day.western_date, days: day.number - 1),
75
+ odd_solar_terms: save_solar_term(term: month.odd_term),
76
+ even_solar_terms: save_solar_term(term: month.even_term)
77
+ )
78
+ end
105
79
 
106
- #
107
- # 月初日データを保存する
108
- #
109
- # @param [Cycle::AbstractRemainder] remainder 大余小余情報
110
- # @param [Western::Calendar] date 年月日情報(西暦)
111
- # @param [Integer] days 日数(月初日から指定日までの日数)
112
- #
113
- # @return [Result::Day] 日データ
114
- #
115
- def self.save_first_day(remainder:, date:, days:)
116
- western_date = date.clone - days
117
- Result::Data::Day.new(
118
- number: 1,
119
- zodiac_name: remainder.zodiac_name,
120
- remainder: remainder,
121
- western_date: western_date
122
- )
123
- end
124
- private_class_method :save_first_day
80
+ #
81
+ # 月初日データを保存する
82
+ #
83
+ # @param [Cycle::AbstractRemainder] remainder 大余小余情報
84
+ # @param [Western::Calendar] date 年月日情報(西暦)
85
+ # @param [Integer] days 日数(月初日から指定日までの日数)
86
+ #
87
+ # @return [Result::Day] 日データ
88
+ #
89
+ def save_first_day(remainder:, date:, days:)
90
+ western_date = date.clone - days
91
+ Result::Data::Day.new(
92
+ number: 1,
93
+ zodiac_name: remainder.zodiac_name,
94
+ remainder: remainder,
95
+ western_date: western_date
96
+ )
97
+ end
98
+
99
+ #
100
+ # 二十四節気データを保存する
101
+ #
102
+ # @note 今は宣明暦に合わせている。江戸期以降の暦には対応していない(複数の中気節気を指定できない)
103
+ #
104
+ # @param [SolarTerm] term 二十四節気情報(各暦のデータ型)
105
+ #
106
+ # @return [Array<Result::SolarTerm>] 二十四節気データ
107
+ #
108
+ def save_solar_term(term:)
109
+ return [] if term.invalid?
125
110
 
126
- #
127
- # 二十四節気データを保存する
128
- #
129
- # @note 今は宣明暦に合わせている。江戸期以降の暦には対応していない(複数の中気節気を指定できない)
130
- #
131
- # @param [SolarTerm] term 二十四節気情報(各暦のデータ型)
132
- #
133
- # @return [Array<Result::SolarTerm>] 二十四節気データ
134
- #
135
- def self.save_solar_term(term:)
136
- return [] if term.invalid?
111
+ [
112
+ Result::Data::SolarTerm.new(
113
+ index: term.index,
114
+ remainder: term.remainder
115
+ )
116
+ ]
117
+ end
137
118
 
138
- [
139
- Result::Data::SolarTerm.new(
140
- index: term.index,
141
- remainder: term.remainder
119
+ #
120
+ # 日データを保存する
121
+ #
122
+ # @param [Calculation::Base::Day] day 日情報
123
+ #
124
+ # @return [Result::Day] 日データ
125
+ #
126
+ def save_day(day:)
127
+ remainder = day.remainder
128
+ Result::Data::Day.new(
129
+ number: day.number,
130
+ zodiac_name: remainder.zodiac_name,
131
+ remainder: remainder,
132
+ western_date: day.western_date
142
133
  )
143
- ]
144
- end
145
- private_class_method :save_solar_term
146
-
147
- #
148
- # 日データを保存する
149
- #
150
- # @param [Month] month 月情報(各暦のデータ型)
151
- # @param [Western::Calendar] date 年月日情報(西暦)
152
- # @param [Integer] days 日数(月初日から指定日までの日数)
153
- #
154
- # @return [Result::Day] 日データ
155
- #
156
- def self.save_day(month:, date:, days:)
157
- remainder = month.remainder
158
- remainder = remainder.add(
159
- # 常に参照元のRemainderクラスで生成する
160
- remainder.class.new(day: days, minute: 0, second: 0)
161
- )
162
- Result::Data::Day.new(
163
- number: (days + 1),
164
- zodiac_name: remainder.zodiac_name,
165
- remainder: remainder,
166
- western_date: date
167
- )
134
+ end
168
135
  end
169
- private_class_method :save_day
170
136
  end
171
137
  end
172
138
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nodoc:
4
+ module Zakuro
5
+ #
6
+ # Result 演算結果
7
+ #
8
+ module Result
9
+ #
10
+ # データ部
11
+ #
12
+ module Data
13
+ #
14
+ # Option オプション
15
+ #
16
+ module Option
17
+ #
18
+ # AbstractOption 抽象オプション結果
19
+ #
20
+ class AbstractOption
21
+ # @return [True] オプション値有
22
+ # @return [False] オプション値無
23
+ attr_reader :matched
24
+
25
+ #
26
+ # 初期化
27
+ #
28
+ # @param [True, False] matched オプション値有無
29
+ #
30
+ def initialize(matched: false)
31
+ @matched = matched
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './solar_term'
4
+
5
+ # :nodoc:
6
+ module Zakuro
7
+ #
8
+ # Result 演算結果
9
+ #
10
+ module Result
11
+ #
12
+ # データ部
13
+ #
14
+ module Data
15
+ #
16
+ # Option オプション
17
+ #
18
+ module Option
19
+ #
20
+ # DroppedDate 没日
21
+ #
22
+ module DroppedDate
23
+ #
24
+ # Calculation 演算値
25
+ #
26
+ class Calculation
27
+ # @return [String] 大余小余(没余)
28
+ attr_reader :remainder
29
+ # @return [SolarTerm] 二十四節気
30
+ attr_reader :solar_term
31
+
32
+ #
33
+ # 初期化
34
+ #
35
+ # @param [String] remainder 大余小余(没余)
36
+ # @param [SolarTerm] solar_term 二十四節気
37
+ #
38
+ def initialize(remainder: '', solar_term: SolarTerm.new)
39
+ @remainder = remainder
40
+ @solar_term = solar_term
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../abstract_option'
4
+
5
+ require_relative './calculation'
6
+
7
+ # :nodoc:
8
+ module Zakuro
9
+ #
10
+ # Result 演算結果
11
+ #
12
+ module Result
13
+ #
14
+ # データ部
15
+ #
16
+ module Data
17
+ #
18
+ # Option オプション
19
+ #
20
+ module Option
21
+ #
22
+ # DroppedDate 没日
23
+ #
24
+ module DroppedDate
25
+ #
26
+ # Option 没日集約
27
+ #
28
+ class Option < AbstractOption
29
+ # @return [Calculation] 演算値
30
+ attr_reader :calculation
31
+
32
+ #
33
+ # 初期化
34
+ #
35
+ # @param [True, False] matched オプション値有無
36
+ # @param [Calculation] calculation 演算値
37
+ #
38
+ def initialize(matched: false, calculation: Calculation.new)
39
+ super(matched: matched)
40
+ @calculation = calculation
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nodoc:
4
+ module Zakuro
5
+ #
6
+ # Result 演算結果
7
+ #
8
+ module Result
9
+ #
10
+ # データ部
11
+ #
12
+ module Data
13
+ #
14
+ # Option オプション
15
+ #
16
+ module Option
17
+ #
18
+ # DroppedDate 没日
19
+ #
20
+ module DroppedDate
21
+ #
22
+ # SolarTerm 二十四節気
23
+ #
24
+ class SolarTerm
25
+ # @return [Interger] 不正連番
26
+ INVALID = -1
27
+
28
+ # @return [Integer] 連番
29
+ attr_reader :index
30
+ # @return [String] 大余小余
31
+ attr_reader :remainder
32
+
33
+ #
34
+ # 初期化
35
+ #
36
+ # @param [Integer] index 連番
37
+ # @param [String] remainder 大余小余
38
+ #
39
+ def initialize(index: INVALID, remainder: '')
40
+ @index = index
41
+ @remainder = remainder
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -2,6 +2,10 @@
2
2
 
3
3
  require_relative '../core'
4
4
 
5
+ require_relative './option/abstract_option'
6
+
7
+ require_relative './option/dropped_date/option'
8
+
5
9
  require_relative 'year'
6
10
 
7
11
  require_relative 'month'
@@ -28,6 +32,8 @@ module Zakuro
28
32
  attr_reader :month
29
33
  # @return [Day] 日
30
34
  attr_reader :day
35
+ # @return [Hash<String, Option::AbstractOption>] オプション
36
+ attr_reader :options
31
37
 
32
38
  #
33
39
  # 初期化
@@ -35,12 +41,14 @@ module Zakuro
35
41
  # @param [Year] year 年
36
42
  # @param [Month] month 月
37
43
  # @param [Day] day 日
44
+ # @param [Hash<String, Option::AbstractOption>] options オプション
38
45
  #
39
- def initialize(year:, month:, day:)
46
+ def initialize(year:, month:, day:, options: {})
40
47
  super
41
48
  @year = year
42
49
  @month = month
43
50
  @day = day
51
+ @options = options
44
52
  end
45
53
  end
46
54
  end
@@ -9,11 +9,11 @@ module Zakuro
9
9
  #
10
10
  # 運用情報
11
11
  #
12
- module Operation
12
+ class Operation
13
13
  #
14
14
  # Month 運用情報(月)
15
15
  #
16
- module Month
16
+ class Month
17
17
  #
18
18
  # Annotation 注釈
19
19
  #
@@ -11,11 +11,11 @@ module Zakuro
11
11
  #
12
12
  # 運用情報
13
13
  #
14
- module Operation
14
+ class Operation
15
15
  #
16
16
  # Month 運用情報(月)
17
17
  #
18
- module Month
18
+ class Month
19
19
  #
20
20
  # History 月別履歴情報
21
21
  #
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './month/history'
4
+
5
+ # :nodoc:
6
+ module Zakuro
7
+ #
8
+ # Result 演算結果
9
+ #
10
+ module Result
11
+ #
12
+ # 運用情報
13
+ #
14
+ class Operation
15
+ #
16
+ # Month 運用情報(月)
17
+ #
18
+ class Month
19
+ # @return [History] 月別履歴情報(当月)
20
+ attr_reader :current
21
+ # @return [History] 月別履歴情報(影響を与えた月)
22
+ attr_reader :parent
23
+
24
+ def initialize(current: History.new, parent: History.new)
25
+ @current = current
26
+ @parent = parent
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './data/single_day'
4
+
5
+ require_relative './operation/month'
6
+
7
+ # :nodoc:
8
+ module Zakuro
9
+ #
10
+ # Result 演算結果
11
+ #
12
+ module Result
13
+ #
14
+ # Operation 運用情報
15
+ #
16
+ class Operation
17
+ # @return [True] 運用あり
18
+ # @return [False] 運用なし
19
+ attr_reader :operated
20
+ # @return [Month] 月別履歴情報
21
+ attr_reader :month
22
+ # @return [Data::SingleDay] 計算値
23
+ attr_reader :original
24
+
25
+ #
26
+ # 初期化
27
+ #
28
+ # @param [True, False] operated 運用有無
29
+ # @param [Month] month 月別履歴情報
30
+ # @param [Data::SingleDay] original 計算値
31
+ #
32
+ def initialize(operated:, month:, original:)
33
+ @operated = operated
34
+ @month = month
35
+ @original = original
36
+ end
37
+ end
38
+ end
39
+ end
@@ -4,7 +4,7 @@ require 'json'
4
4
 
5
5
  require_relative './data/single_day'
6
6
 
7
- require_relative './operation/operation'
7
+ require_relative './operation'
8
8
 
9
9
  require_relative './core'
10
10
 
@@ -20,14 +20,14 @@ module Zakuro
20
20
  class Single < Core
21
21
  # @return [Data::SingleDay] 1日
22
22
  attr_reader :data
23
- # @return [Operation::Bundle] 運用情報
23
+ # @return [Operation] 運用情報
24
24
  attr_reader :operation
25
25
 
26
26
  #
27
27
  # 初期化
28
28
  #
29
29
  # @param [Data::SingleDay] data 1日
30
- # @param [Operation::Bundle] operation 運用情報
30
+ # @param [Operation] operation 運用情報
31
31
  #
32
32
  def initialize(data:, operation:)
33
33
  super