zakuro 0.6.1 → 0.8.0
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 +46 -17
- 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 +49 -3
- data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
- data/lib/zakuro/calculation/base/operated_year.rb +26 -24
- data/lib/zakuro/calculation/base/year.rb +7 -7
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +55 -47
- data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +28 -24
- data/lib/zakuro/calculation/cycle/zodiac.rb +22 -20
- data/lib/zakuro/calculation/era/gengou/{scroll.rb → abstract_scroll.rb} +44 -37
- data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +30 -0
- data/lib/zakuro/calculation/era/gengou/internal/connector.rb +4 -4
- data/lib/zakuro/calculation/era/gengou/internal/counter.rb +16 -16
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +74 -72
- data/lib/zakuro/calculation/era/gengou/internal/reserve/{list.rb → abstract_list.rb} +50 -64
- data/lib/zakuro/calculation/era/gengou/internal/reserve/{range.rb → abstract_range.rb} +73 -50
- 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 +156 -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 +73 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +23 -22
- data/lib/zakuro/calculation/era/gengou/named_scroll.rb +30 -0
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +39 -22
- data/lib/zakuro/calculation/era/version/version.rb +12 -10
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +13 -9
- data/lib/zakuro/calculation/monthly/const.rb +18 -0
- data/lib/zakuro/calculation/monthly/initialized_month.rb +40 -38
- data/lib/zakuro/calculation/monthly/month.rb +55 -16
- data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
- data/lib/zakuro/calculation/monthly/operated_month.rb +37 -86
- data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
- 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} +45 -29
- data/lib/zakuro/calculation/range/abstract_operation_range.rb +193 -0
- 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 +64 -63
- 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_term.rb +220 -0
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +32 -29
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +115 -117
- data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +1 -1
- data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +48 -46
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +31 -26
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +7 -5
- data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
- data/lib/zakuro/calculation/summary/internal/day.rb +42 -0
- data/lib/zakuro/calculation/{specifier → summary}/internal/month.rb +33 -12
- data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
- data/lib/zakuro/calculation/summary/internal/option.rb +101 -0
- data/lib/zakuro/calculation/summary/japan/range.rb +179 -0
- data/lib/zakuro/calculation/summary/japan/single.rb +118 -0
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +98 -0
- data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
- data/lib/zakuro/calculation/summary/western/range.rb +127 -0
- data/lib/zakuro/calculation/summary/western/single.rb +115 -0
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +173 -0
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +100 -0
- data/lib/zakuro/calculation/type/old_float.rb +2 -2
- data/lib/zakuro/calculation/type/optional.rb +46 -0
- data/lib/zakuro/condition.rb +143 -94
- data/lib/zakuro/context/context.rb +44 -0
- data/lib/zakuro/context/option.rb +119 -0
- data/lib/zakuro/context/version_class_resolver.rb +112 -0
- data/lib/zakuro/era/japan/calendar.rb +35 -33
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +93 -74
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +135 -133
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +143 -122
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +177 -168
- data/lib/zakuro/era/japan/gengou/alignment.rb +40 -25
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +199 -181
- data/lib/zakuro/era/japan/gengou/resource/type.rb +243 -234
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +257 -254
- data/lib/zakuro/era/japan/gengou/resource.rb +23 -22
- data/lib/zakuro/era/japan/gengou.rb +28 -41
- data/lib/zakuro/era/japan/version.rb +18 -16
- data/lib/zakuro/era/western/calendar.rb +104 -88
- 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 +39 -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 +81 -0
- data/lib/zakuro/merchant.rb +67 -33
- data/lib/zakuro/operation/month/parser.rb +252 -249
- data/lib/zakuro/operation/month/type.rb +44 -35
- data/lib/zakuro/operation/month/validator.rb +182 -178
- data/lib/zakuro/operation/operation.rb +38 -36
- data/lib/zakuro/operation/yaml/month.yaml +3736 -3736
- data/lib/zakuro/output/logger.rb +17 -3
- data/lib/zakuro/output/response.rb +107 -141
- 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/month/annotation.rb +40 -0
- data/lib/zakuro/result/operation/month/history.rb +54 -0
- data/lib/zakuro/result/operation/month.rb +31 -0
- data/lib/zakuro/result/operation.rb +22 -97
- data/lib/zakuro/result/result.rb +6 -4
- data/lib/zakuro/tools/stringifier.rb +67 -42
- data/lib/zakuro/tools/typeconv.rb +17 -15
- data/lib/zakuro/tools/typeof.rb +15 -13
- data/lib/zakuro/version/daien/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -37
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -47
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/daien/stella/solar/average.rb +53 -51
- data/lib/zakuro/version/daien/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/daien/stella/solar/value.rb +13 -11
- data/lib/zakuro/version/genka/cycle/remainder.rb +4 -4
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/genka/range/annual_range.rb +48 -44
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +30 -28
- data/lib/zakuro/version/genka/stella/origin/january.rb +22 -20
- data/lib/zakuro/version/gihou/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -37
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -47
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +24 -22
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/gihou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/gihou/stella/solar/value.rb +13 -11
- 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/monthly/lunar_phase.rb +10 -10
- data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +33 -0
- data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -36
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -34
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +13 -11
- metadata +68 -16
- data/lib/zakuro/calculation/range/operated_range.rb +0 -193
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -220
- data/lib/zakuro/calculation/specifier/multiple_day.rb +0 -162
- data/lib/zakuro/calculation/specifier/single_day.rb +0 -87
- data/lib/zakuro/calculation/summary/range.rb +0 -120
- data/lib/zakuro/calculation/summary/single.rb +0 -110
- data/lib/zakuro/result/data.rb +0 -187
- data/lib/zakuro/version/context.rb +0 -44
- data/lib/zakuro/version/version_class_resolver.rb +0 -74
data/lib/zakuro/result/data.rb
DELETED
@@ -1,187 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './core'
|
4
|
-
|
5
|
-
# :nodoc:
|
6
|
-
module Zakuro
|
7
|
-
#
|
8
|
-
# Result 演算結果
|
9
|
-
#
|
10
|
-
module Result
|
11
|
-
#
|
12
|
-
# データ部
|
13
|
-
#
|
14
|
-
module Data
|
15
|
-
#
|
16
|
-
# SingleDay 1日
|
17
|
-
#
|
18
|
-
class SingleDay < Core
|
19
|
-
# @return [Year] 年
|
20
|
-
attr_reader :year
|
21
|
-
# @return [Month] 月
|
22
|
-
attr_reader :month
|
23
|
-
# @return [Day] 日
|
24
|
-
attr_reader :day
|
25
|
-
|
26
|
-
#
|
27
|
-
# 初期化
|
28
|
-
#
|
29
|
-
# @param [Year] year 年
|
30
|
-
# @param [Month] month 月
|
31
|
-
# @param [Day] day 日
|
32
|
-
#
|
33
|
-
def initialize(year:, month:, day:)
|
34
|
-
super
|
35
|
-
@year = year
|
36
|
-
@month = month
|
37
|
-
@day = day
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Gengou 元号
|
43
|
-
#
|
44
|
-
class Gengou
|
45
|
-
# @return [String] 元号名
|
46
|
-
attr_reader :name
|
47
|
-
# @return [Integer] 元号年
|
48
|
-
attr_reader :number
|
49
|
-
|
50
|
-
#
|
51
|
-
# 初期化
|
52
|
-
#
|
53
|
-
# @param [String] name 元号名
|
54
|
-
# @param [Integer] number 元号年
|
55
|
-
#
|
56
|
-
def initialize(name: '', number: -1)
|
57
|
-
@name = name
|
58
|
-
@number = number
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Year 年
|
64
|
-
#
|
65
|
-
class Year
|
66
|
-
# @return [Gengou] 元号(1行目)
|
67
|
-
attr_reader :first_gengou
|
68
|
-
# @return [Gengou] 元号(2行目)
|
69
|
-
attr_reader :second_gengou
|
70
|
-
# @return [String] 十干十二支
|
71
|
-
attr_reader :zodiac_name
|
72
|
-
# @return [Integer] 日数
|
73
|
-
attr_reader :total_days
|
74
|
-
|
75
|
-
#
|
76
|
-
# 初期化
|
77
|
-
#
|
78
|
-
# @param [Gengou] first_gengou 元号(1行目)
|
79
|
-
# @param [Gengou] second_gengou 元号(2行目)
|
80
|
-
# @param [String] zodiac_name 十干十二支
|
81
|
-
# @param [Integer] total_days 日数
|
82
|
-
#
|
83
|
-
def initialize(first_gengou:, second_gengou:, zodiac_name:, total_days:)
|
84
|
-
@first_gengou = first_gengou
|
85
|
-
@second_gengou = second_gengou
|
86
|
-
@zodiac_name = zodiac_name
|
87
|
-
@total_days = total_days
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# SolarTerm 二十四節気
|
93
|
-
#
|
94
|
-
class SolarTerm
|
95
|
-
# @return [Integer] 連番
|
96
|
-
attr_reader :index
|
97
|
-
# @return [String] 大余小余
|
98
|
-
attr_reader :remainder
|
99
|
-
|
100
|
-
#
|
101
|
-
# 初期化
|
102
|
-
#
|
103
|
-
# @param [Integer] index 連番
|
104
|
-
# @param [String] remainder 大余小余
|
105
|
-
#
|
106
|
-
def initialize(index:, remainder:)
|
107
|
-
@index = index
|
108
|
-
@remainder = remainder
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# :reek:TooManyInstanceVariables { max_instance_variables: 6 }
|
113
|
-
|
114
|
-
#
|
115
|
-
# Month 月
|
116
|
-
#
|
117
|
-
class Month
|
118
|
-
# @return [Integer] 月順(1-12)
|
119
|
-
attr_reader :number
|
120
|
-
# @return [True] 閏月
|
121
|
-
# @return [False] 平月
|
122
|
-
attr_reader :leaped
|
123
|
-
# @return [String] 月の大小
|
124
|
-
attr_reader :days_name
|
125
|
-
# @return [Day] 月初日データ
|
126
|
-
attr_reader :first_day
|
127
|
-
# @return [SolarTerm] 二十四節気(節気)
|
128
|
-
attr_reader :odd_solar_terms
|
129
|
-
# @return [SolarTerm] 二十四節気(中気)
|
130
|
-
attr_reader :even_solar_terms
|
131
|
-
|
132
|
-
# rubocop:disable Metrics/ParameterLists
|
133
|
-
# :reek:LongParameterList { max_params: 6 }
|
134
|
-
|
135
|
-
#
|
136
|
-
# 初期化
|
137
|
-
#
|
138
|
-
# @param [Integer] number 月順(1-12)
|
139
|
-
# @param [True, False] leaped 閏月/平月
|
140
|
-
# @param [String] days_name 月の大小
|
141
|
-
# @param [Day] first_day 月初日データ
|
142
|
-
# @param [SolarTerm] odd_solar_terms 二十四節気(節気)
|
143
|
-
# @param [SolarTerm] even_solar_terms 二十四節気(中気)
|
144
|
-
#
|
145
|
-
def initialize(number:, leaped:, days_name:, first_day:,
|
146
|
-
odd_solar_terms:, even_solar_terms:)
|
147
|
-
@number = number
|
148
|
-
@leaped = leaped
|
149
|
-
@days_name = days_name
|
150
|
-
@first_day = first_day
|
151
|
-
@odd_solar_terms = odd_solar_terms
|
152
|
-
@even_solar_terms = even_solar_terms
|
153
|
-
end
|
154
|
-
# rubocop:enable Metrics/ParameterLists
|
155
|
-
end
|
156
|
-
|
157
|
-
#
|
158
|
-
# Day 日
|
159
|
-
#
|
160
|
-
class Day
|
161
|
-
# @return [Integer] 月初日から数えた日(M月d日のdに相当)
|
162
|
-
attr_reader :number
|
163
|
-
# @return [String] 十干十二支
|
164
|
-
attr_reader :zodiac_name
|
165
|
-
# @return [String] 大余小余
|
166
|
-
attr_reader :remainder
|
167
|
-
# @return [String] 年月日
|
168
|
-
attr_reader :western_date
|
169
|
-
|
170
|
-
#
|
171
|
-
# 初期化
|
172
|
-
#
|
173
|
-
# @param [Integer] number 月初日から数えた日(M月d日のdに相当)
|
174
|
-
# @param [String] zodiac_name 十干十二支
|
175
|
-
# @param [String] remainder 大余小余
|
176
|
-
# @param [String] western_date 年月日
|
177
|
-
#
|
178
|
-
def initialize(number:, zodiac_name:, remainder:, western_date:)
|
179
|
-
@number = number
|
180
|
-
@zodiac_name = zodiac_name
|
181
|
-
@remainder = remainder
|
182
|
-
@western_date = western_date
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './version_class_resolver'
|
4
|
-
|
5
|
-
# :nodoc:
|
6
|
-
module Zakuro
|
7
|
-
#
|
8
|
-
# Context 暦コンテキスト
|
9
|
-
#
|
10
|
-
class Context
|
11
|
-
# @return [String] 暦名
|
12
|
-
attr_reader :version_name
|
13
|
-
# @return [VersionClassResolver] 暦リゾルバー
|
14
|
-
attr_reader :resolver
|
15
|
-
|
16
|
-
# @return [Array<String>] 暦名
|
17
|
-
VERSION_NAMES = %w[Genka Gihou Daien Senmyou Joukyou Kansei Tenpou Gregorio].freeze
|
18
|
-
|
19
|
-
#
|
20
|
-
# 初期化
|
21
|
-
#
|
22
|
-
# @param [String] version_name 暦名
|
23
|
-
#
|
24
|
-
def initialize(version_name: '')
|
25
|
-
@version_name = version_name
|
26
|
-
|
27
|
-
if !invalid? && !VERSION_NAMES.include?(version_name)
|
28
|
-
raise ArgumentError.new, 'invalid version'
|
29
|
-
end
|
30
|
-
|
31
|
-
@resolver = VersionClassResolver.new(version_name: version_name)
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
# 不正か
|
36
|
-
#
|
37
|
-
# @return [True] 不正
|
38
|
-
# @return [False] 不正なし
|
39
|
-
#
|
40
|
-
def invalid?
|
41
|
-
@version_name.empty?
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './genka/cycle/remainder'
|
4
|
-
require_relative './genka/cycle/solar_term'
|
5
|
-
require_relative './genka/range/annual_range'
|
6
|
-
|
7
|
-
require_relative './gihou/cycle/remainder'
|
8
|
-
require_relative './gihou/cycle/solar_term'
|
9
|
-
require_relative './gihou/range/annual_range'
|
10
|
-
|
11
|
-
require_relative './daien/cycle/remainder'
|
12
|
-
require_relative './daien/cycle/solar_term'
|
13
|
-
require_relative './daien/range/annual_range'
|
14
|
-
|
15
|
-
require_relative './senmyou/cycle/remainder'
|
16
|
-
require_relative './senmyou/cycle/solar_term'
|
17
|
-
require_relative './senmyou/range/annual_range'
|
18
|
-
|
19
|
-
# :nodoc:
|
20
|
-
module Zakuro
|
21
|
-
#
|
22
|
-
# VersionClassResolver 暦リゾルバー
|
23
|
-
#
|
24
|
-
class VersionClassResolver
|
25
|
-
attr_reader :version_name
|
26
|
-
|
27
|
-
CLASSES = {
|
28
|
-
'remainder' => 'Zakuro::$VERSION::Cycle::Remainder',
|
29
|
-
'solar_term' => 'Zakuro::$VERSION::Cycle::SolarTerm',
|
30
|
-
'annual_range' => 'Zakuro::$VERSION::Range::AnnualRange'
|
31
|
-
}.freeze
|
32
|
-
|
33
|
-
def initialize(version_name:)
|
34
|
-
@version_name = version_name
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.get_class(version_name:, class_name:)
|
38
|
-
constant = CLASSES.fetch(class_name, '')
|
39
|
-
|
40
|
-
raise ArgumentError.new, 'invalid class name' if constant == ''
|
41
|
-
|
42
|
-
resolved_constant = constant.gsub('$VERSION', version_name)
|
43
|
-
|
44
|
-
Object.const_get(resolved_constant)
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# 大余小余(暦別)クラスを返す
|
49
|
-
#
|
50
|
-
# @return [Class] 大余小余(暦別)クラス
|
51
|
-
#
|
52
|
-
def remainder
|
53
|
-
VersionClassResolver.get_class(version_name: @version_name, class_name: 'remainder')
|
54
|
-
end
|
55
|
-
|
56
|
-
#
|
57
|
-
# 二十四節気クラスを返す
|
58
|
-
#
|
59
|
-
# @return [Class] 二十四節気クラス
|
60
|
-
#
|
61
|
-
def solar_term
|
62
|
-
VersionClassResolver.get_class(version_name: @version_name, class_name: 'solar_term')
|
63
|
-
end
|
64
|
-
|
65
|
-
#
|
66
|
-
# 年間範囲クラスを返す
|
67
|
-
#
|
68
|
-
# @return [Class] 年間範囲クラス
|
69
|
-
#
|
70
|
-
def annual_range
|
71
|
-
VersionClassResolver.get_class(version_name: @version_name, class_name: 'annual_range')
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|