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
data/lib/zakuro/output/logger.rb
CHANGED
@@ -12,9 +12,9 @@ module Zakuro
|
|
12
12
|
LEVELS = {
|
13
13
|
none: -1,
|
14
14
|
debug: 0,
|
15
|
-
info: 1
|
16
|
-
|
17
|
-
|
15
|
+
info: 1,
|
16
|
+
warn: 2,
|
17
|
+
error: 3
|
18
18
|
}.freeze
|
19
19
|
|
20
20
|
LEVEL = LEVELS[:none]
|
@@ -48,6 +48,20 @@ module Zakuro
|
|
48
48
|
output('INFO', *messages)
|
49
49
|
end
|
50
50
|
|
51
|
+
#
|
52
|
+
# ERRORレベルの標準出力を行う
|
53
|
+
#
|
54
|
+
# @param [Error] error 例外
|
55
|
+
# @param [String] messages メッセージ
|
56
|
+
#
|
57
|
+
def error(error, *messages)
|
58
|
+
return if LEVEL < LEVELS[:error]
|
59
|
+
|
60
|
+
output('ERROR', *messages)
|
61
|
+
output('ERROR', error.message)
|
62
|
+
output('ERROR', *error.backtrace)
|
63
|
+
end
|
64
|
+
|
51
65
|
private
|
52
66
|
|
53
67
|
#
|
@@ -14,63 +14,37 @@ 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
|
-
|
30
|
-
#
|
31
|
-
# 初期化
|
32
|
-
#
|
33
|
-
# @param [Year] year 年情報(各暦のデータ型)
|
34
|
-
# @param [Month] month 月情報(各暦のデータ型)
|
35
|
-
# @param [Western::Calendar] date 年月日情報(西暦)
|
36
|
-
# @param [Integer] days 日数(月初日から指定日までの日数)
|
37
|
-
#
|
38
|
-
def initialize(year:, month:, date:, days:)
|
39
|
-
@year = year
|
40
|
-
@month = month
|
41
|
-
@date = date
|
42
|
-
@days = days
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
17
|
#
|
47
18
|
# 1日データを生成する
|
48
19
|
#
|
49
|
-
# @param [
|
20
|
+
# @param [Calculation::Base::Year] year 年情報(各暦のデータ型)
|
21
|
+
# @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
|
22
|
+
# @param [Calculation::Base::Day] day 日情報
|
23
|
+
# @param [Hash<String, Result::Data::Option::AbstractOption>] options オプション
|
50
24
|
#
|
51
|
-
# @return [SingleDay] 1日データ
|
25
|
+
# @return [Result::Data::SingleDay] 1日データ
|
52
26
|
#
|
53
|
-
def self.
|
54
|
-
year = param.year
|
55
|
-
month = param.month
|
56
|
-
date = param.date
|
57
|
-
days = param.days
|
27
|
+
def self.create(year:, month:, day:, options: {})
|
58
28
|
Result::Data::SingleDay.new(
|
59
|
-
year: save_year(year: year, month: month,
|
60
|
-
month: save_month(month: month,
|
61
|
-
day: save_day(
|
29
|
+
year: save_year(year: year, month: month, day: day),
|
30
|
+
month: save_month(month: month, day: day),
|
31
|
+
day: save_day(day: day),
|
32
|
+
options: options
|
62
33
|
)
|
63
34
|
end
|
64
35
|
|
65
36
|
#
|
66
37
|
# 年データを保存する
|
67
38
|
#
|
68
|
-
# @param [Year] year 年情報(各暦のデータ型)
|
39
|
+
# @param [Calculation::Base::Year] year 年情報(各暦のデータ型)
|
40
|
+
# @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
|
41
|
+
# @param [Calculation::Base::Day] day 日情報
|
69
42
|
#
|
70
43
|
# @return [Result::Year] 年データ
|
71
44
|
#
|
72
|
-
def self.save_year(year:, month:,
|
45
|
+
def self.save_year(year:, month:, day:)
|
73
46
|
gengou = month.gengou
|
47
|
+
date = day.western_date
|
74
48
|
first = gengou.match_first_line(date: date)
|
75
49
|
second = gengou.match_second_line(date: date)
|
76
50
|
Result::Data::Year.new(
|
@@ -86,17 +60,16 @@ module Zakuro
|
|
86
60
|
#
|
87
61
|
# 月データを保存する
|
88
62
|
#
|
89
|
-
# @param [Month] month 月情報(各暦のデータ型)
|
90
|
-
# @param [
|
91
|
-
# @param [Integer] days 日数(月初日から指定日までの日数)
|
63
|
+
# @param [Calculation::Monthly::Month] month 月情報(各暦のデータ型)
|
64
|
+
# @param [Calculation::Base::Day] day 日情報
|
92
65
|
#
|
93
66
|
# @return [Result::Month] 月データ
|
94
67
|
#
|
95
|
-
def self.save_month(month:,
|
68
|
+
def self.save_month(month:, day:)
|
96
69
|
Result::Data::Month.new(
|
97
70
|
number: month.number, leaped: month.leaped?, days_name: month.days_name,
|
98
71
|
first_day: save_first_day(remainder: month.remainder,
|
99
|
-
date:
|
72
|
+
date: day.western_date, days: day.number - 1),
|
100
73
|
odd_solar_terms: save_solar_term(term: month.odd_term),
|
101
74
|
even_solar_terms: save_solar_term(term: month.even_term)
|
102
75
|
)
|
@@ -147,23 +120,17 @@ module Zakuro
|
|
147
120
|
#
|
148
121
|
# 日データを保存する
|
149
122
|
#
|
150
|
-
# @param [
|
151
|
-
# @param [Western::Calendar] date 年月日情報(西暦)
|
152
|
-
# @param [Integer] days 日数(月初日から指定日までの日数)
|
123
|
+
# @param [Calculation::Base::Day] day 日情報
|
153
124
|
#
|
154
125
|
# @return [Result::Day] 日データ
|
155
126
|
#
|
156
|
-
def self.save_day(
|
157
|
-
remainder =
|
158
|
-
remainder = remainder.add(
|
159
|
-
# 常に参照元のRemainderクラスで生成する
|
160
|
-
remainder.class.new(day: days, minute: 0, second: 0)
|
161
|
-
)
|
127
|
+
def self.save_day(day:)
|
128
|
+
remainder = day.remainder
|
162
129
|
Result::Data::Day.new(
|
163
|
-
number:
|
130
|
+
number: day.number,
|
164
131
|
zodiac_name: remainder.zodiac_name,
|
165
132
|
remainder: remainder,
|
166
|
-
western_date:
|
133
|
+
western_date: day.western_date
|
167
134
|
)
|
168
135
|
end
|
169
136
|
private_class_method :save_day
|
@@ -0,0 +1,43 @@
|
|
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
|
+
# Day 日
|
15
|
+
#
|
16
|
+
class Day
|
17
|
+
# @return [Integer] 月初日から数えた日(M月d日のdに相当)
|
18
|
+
attr_reader :number
|
19
|
+
# @return [String] 十干十二支
|
20
|
+
attr_reader :zodiac_name
|
21
|
+
# @return [String] 大余小余
|
22
|
+
attr_reader :remainder
|
23
|
+
# @return [String] 年月日
|
24
|
+
attr_reader :western_date
|
25
|
+
|
26
|
+
#
|
27
|
+
# 初期化
|
28
|
+
#
|
29
|
+
# @param [Integer] number 月初日から数えた日(M月d日のdに相当)
|
30
|
+
# @param [String] zodiac_name 十干十二支
|
31
|
+
# @param [String] remainder 大余小余
|
32
|
+
# @param [String] western_date 年月日
|
33
|
+
#
|
34
|
+
def initialize(number:, zodiac_name:, remainder:, western_date:)
|
35
|
+
@number = number
|
36
|
+
@zodiac_name = zodiac_name
|
37
|
+
@remainder = remainder
|
38
|
+
@western_date = western_date
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
+
# Gengou 元号
|
15
|
+
#
|
16
|
+
class Gengou
|
17
|
+
# @return [String] 元号名
|
18
|
+
attr_reader :name
|
19
|
+
# @return [Integer] 元号年
|
20
|
+
attr_reader :number
|
21
|
+
|
22
|
+
#
|
23
|
+
# 初期化
|
24
|
+
#
|
25
|
+
# @param [String] name 元号名
|
26
|
+
# @param [Integer] number 元号年
|
27
|
+
#
|
28
|
+
def initialize(name: '', number: -1)
|
29
|
+
@name = name
|
30
|
+
@number = number
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './day'
|
4
|
+
|
5
|
+
require_relative './solar_term'
|
6
|
+
|
7
|
+
# :nodoc:
|
8
|
+
module Zakuro
|
9
|
+
#
|
10
|
+
# Result 演算結果
|
11
|
+
#
|
12
|
+
module Result
|
13
|
+
#
|
14
|
+
# データ部
|
15
|
+
#
|
16
|
+
module Data
|
17
|
+
# :reek:TooManyInstanceVariables { max_instance_variables: 6 }
|
18
|
+
|
19
|
+
#
|
20
|
+
# Month 月
|
21
|
+
#
|
22
|
+
class Month
|
23
|
+
# @return [Integer] 月順(1-12)
|
24
|
+
attr_reader :number
|
25
|
+
# @return [True] 閏月
|
26
|
+
# @return [False] 平月
|
27
|
+
attr_reader :leaped
|
28
|
+
# @return [String] 月の大小
|
29
|
+
attr_reader :days_name
|
30
|
+
# @return [Day] 月初日データ
|
31
|
+
attr_reader :first_day
|
32
|
+
# @return [SolarTerm] 二十四節気(節気)
|
33
|
+
attr_reader :odd_solar_terms
|
34
|
+
# @return [SolarTerm] 二十四節気(中気)
|
35
|
+
attr_reader :even_solar_terms
|
36
|
+
|
37
|
+
# rubocop:disable Metrics/ParameterLists
|
38
|
+
# :reek:LongParameterList { max_params: 6 }
|
39
|
+
|
40
|
+
#
|
41
|
+
# 初期化
|
42
|
+
#
|
43
|
+
# @param [Integer] number 月順(1-12)
|
44
|
+
# @param [True, False] leaped 閏月/平月
|
45
|
+
# @param [String] days_name 月の大小
|
46
|
+
# @param [Day] first_day 月初日データ
|
47
|
+
# @param [SolarTerm] odd_solar_terms 二十四節気(節気)
|
48
|
+
# @param [SolarTerm] even_solar_terms 二十四節気(中気)
|
49
|
+
#
|
50
|
+
def initialize(number:, leaped:, days_name:, first_day:,
|
51
|
+
odd_solar_terms:, even_solar_terms:)
|
52
|
+
@number = number
|
53
|
+
@leaped = leaped
|
54
|
+
@days_name = days_name
|
55
|
+
@first_day = first_day
|
56
|
+
@odd_solar_terms = odd_solar_terms
|
57
|
+
@even_solar_terms = even_solar_terms
|
58
|
+
end
|
59
|
+
# rubocop:enable Metrics/ParameterLists
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
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
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../core'
|
4
|
+
|
5
|
+
require_relative './option/abstract_option'
|
6
|
+
|
7
|
+
require_relative './option/dropped_date/option'
|
8
|
+
|
9
|
+
require_relative 'year'
|
10
|
+
|
11
|
+
require_relative 'month'
|
12
|
+
|
13
|
+
require_relative 'day'
|
14
|
+
|
15
|
+
# :nodoc:
|
16
|
+
module Zakuro
|
17
|
+
#
|
18
|
+
# Result 演算結果
|
19
|
+
#
|
20
|
+
module Result
|
21
|
+
#
|
22
|
+
# データ部
|
23
|
+
#
|
24
|
+
module Data
|
25
|
+
#
|
26
|
+
# SingleDay 1日
|
27
|
+
#
|
28
|
+
class SingleDay < Core
|
29
|
+
# @return [Year] 年
|
30
|
+
attr_reader :year
|
31
|
+
# @return [Month] 月
|
32
|
+
attr_reader :month
|
33
|
+
# @return [Day] 日
|
34
|
+
attr_reader :day
|
35
|
+
# @return [Hash<String, Option::AbstractOption>] オプション
|
36
|
+
attr_reader :options
|
37
|
+
|
38
|
+
#
|
39
|
+
# 初期化
|
40
|
+
#
|
41
|
+
# @param [Year] year 年
|
42
|
+
# @param [Month] month 月
|
43
|
+
# @param [Day] day 日
|
44
|
+
# @param [Hash<String, Option::AbstractOption>] options オプション
|
45
|
+
#
|
46
|
+
def initialize(year:, month:, day:, options: {})
|
47
|
+
super
|
48
|
+
@year = year
|
49
|
+
@month = month
|
50
|
+
@day = day
|
51
|
+
@options = options
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
+
# SolarTerm 二十四節気
|
15
|
+
#
|
16
|
+
class SolarTerm
|
17
|
+
# @return [Integer] 連番
|
18
|
+
attr_reader :index
|
19
|
+
# @return [String] 大余小余
|
20
|
+
attr_reader :remainder
|
21
|
+
|
22
|
+
#
|
23
|
+
# 初期化
|
24
|
+
#
|
25
|
+
# @param [Integer] index 連番
|
26
|
+
# @param [String] remainder 大余小余
|
27
|
+
#
|
28
|
+
def initialize(index:, remainder:)
|
29
|
+
@index = index
|
30
|
+
@remainder = remainder
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './gengou'
|
4
|
+
|
5
|
+
# :nodoc:
|
6
|
+
module Zakuro
|
7
|
+
#
|
8
|
+
# Result 演算結果
|
9
|
+
#
|
10
|
+
module Result
|
11
|
+
#
|
12
|
+
# データ部
|
13
|
+
#
|
14
|
+
module Data
|
15
|
+
#
|
16
|
+
# Year 年
|
17
|
+
#
|
18
|
+
class Year
|
19
|
+
# @return [Gengou] 元号(1行目)
|
20
|
+
attr_reader :first_gengou
|
21
|
+
# @return [Gengou] 元号(2行目)
|
22
|
+
attr_reader :second_gengou
|
23
|
+
# @return [String] 十干十二支
|
24
|
+
attr_reader :zodiac_name
|
25
|
+
# @return [Integer] 日数
|
26
|
+
attr_reader :total_days
|
27
|
+
|
28
|
+
#
|
29
|
+
# 初期化
|
30
|
+
#
|
31
|
+
# @param [Gengou] first_gengou 元号(1行目)
|
32
|
+
# @param [Gengou] second_gengou 元号(2行目)
|
33
|
+
# @param [String] zodiac_name 十干十二支
|
34
|
+
# @param [Integer] total_days 日数
|
35
|
+
#
|
36
|
+
def initialize(first_gengou:, second_gengou:, zodiac_name:, total_days:)
|
37
|
+
@first_gengou = first_gengou
|
38
|
+
@second_gengou = second_gengou
|
39
|
+
@zodiac_name = zodiac_name
|
40
|
+
@total_days = total_days
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../data/single_day'
|
4
|
+
|
5
|
+
require_relative './month/bundle'
|
6
|
+
|
7
|
+
# :nodoc:
|
8
|
+
module Zakuro
|
9
|
+
#
|
10
|
+
# Result 演算結果
|
11
|
+
#
|
12
|
+
module Result
|
13
|
+
#
|
14
|
+
# 運用情報
|
15
|
+
#
|
16
|
+
module Operation
|
17
|
+
#
|
18
|
+
# Bundle 運用情報
|
19
|
+
#
|
20
|
+
class Bundle
|
21
|
+
# @return [True] 運用あり
|
22
|
+
# @return [False] 運用なし
|
23
|
+
attr_reader :operated
|
24
|
+
# @return [Month::Bundle] 月別履歴情報
|
25
|
+
attr_reader :month
|
26
|
+
# @return [Data::SingleDay] 計算値
|
27
|
+
attr_reader :original
|
28
|
+
|
29
|
+
#
|
30
|
+
# 初期化
|
31
|
+
#
|
32
|
+
# @param [True, False] operated 運用有無
|
33
|
+
# @param [Month::Bundle] month 月別履歴情報
|
34
|
+
# @param [Data::SingleDay] original 計算値
|
35
|
+
#
|
36
|
+
def initialize(operated:, month:, original:)
|
37
|
+
@operated = operated
|
38
|
+
@month = month
|
39
|
+
@original = original
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|