zakuro 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,79 +13,6 @@ module Zakuro
13
13
  # @return [Integer] 統法(1日=8400分)
14
14
  DAY = 8400
15
15
 
16
- #
17
- # Interval 入気定日加減数(二十四節気の間隔)
18
- #
19
- module Interval
20
- # @return [Hash<Symbol, Remainder>] 一覧
21
- LIST = {
22
- # 冬至(とうじ)・大雪(たいせつ)
23
- touji: Remainder.new(day: 14, minute: 4235, second: 5),
24
- taisetsu: Remainder.new(day: 14, minute: 4235, second: 5),
25
- # 小寒(しょうかん)・小雪(しょうせつ)
26
- shoukan: Remainder.new(day: 14, minute: 5235, second: 5),
27
- shousetsu: Remainder.new(day: 14, minute: 5235, second: 5),
28
- # 大寒(だいかん)・立冬(りっとう)
29
- daikan: Remainder.new(day: 14, minute: 6235, second: 5),
30
- rittou: Remainder.new(day: 14, minute: 6235, second: 5),
31
- # 立春(りっしゅん)・霜降(そうこう)
32
- risshun: Remainder.new(day: 14, minute: 7235, second: 5),
33
- soukou: Remainder.new(day: 14, minute: 7235, second: 5),
34
- # 雨水(うすい)・寒露(かんろ)
35
- usui: Remainder.new(day: 15, minute: 35, second: 5),
36
- kanro: Remainder.new(day: 15, minute: 35, second: 5),
37
- # 啓蟄(けいちつ)・秋分(しゅうぶん)
38
- keichitsu: Remainder.new(day: 15, minute: 1235, second: 5),
39
- shuubun: Remainder.new(day: 15, minute: 1235, second: 5),
40
- # 春分(しゅんぶん)・白露(はくろ)
41
- shunbun: Remainder.new(day: 15, minute: 2435, second: 5),
42
- hakuro: Remainder.new(day: 15, minute: 2435, second: 5),
43
- # 清明(せいめい)・処暑(しょしょ)
44
- seimei: Remainder.new(day: 15, minute: 3635, second: 5),
45
- shosho: Remainder.new(day: 15, minute: 3635, second: 5),
46
- # 穀雨(こくう)・立秋(りっしゅう)
47
- kokuu: Remainder.new(day: 15, minute: 4835, second: 5),
48
- risshuu: Remainder.new(day: 15, minute: 4835, second: 5),
49
- # 立夏(りっか)・大暑(たいしょ)
50
- rikka: Remainder.new(day: 15, minute: 5835, second: 5),
51
- taisho: Remainder.new(day: 15, minute: 5835, second: 5),
52
- # 小満(しょうまん)・小暑(しょうしょ)
53
- shouman: Remainder.new(day: 15, minute: 6835, second: 5),
54
- shousho: Remainder.new(day: 15, minute: 6835, second: 5),
55
- # 芒種(ぼうしゅ)・夏至(げし)
56
- boushu: Remainder.new(day: 15, minute: 7835, second: 5),
57
- geshi: Remainder.new(day: 15, minute: 7835, second: 5)
58
- }.freeze
59
-
60
- # @return [Array<Remainder>] 索引
61
- INDEXES = [
62
- LIST[:touji], # 0
63
- LIST[:shoukan], # 1
64
- LIST[:daikan], # 2
65
- LIST[:risshun], # 3
66
- LIST[:usui], # 4
67
- LIST[:keichitsu], # 5
68
- LIST[:shunbun], # 6
69
- LIST[:seimei], # 7
70
- LIST[:kokuu], # 8
71
- LIST[:rikka], # 9
72
- LIST[:shouman], # 10
73
- LIST[:boushu], # 11
74
- LIST[:geshi], # 12
75
- LIST[:shousho], # 13
76
- LIST[:taisho], # 14
77
- LIST[:risshuu], # 15
78
- LIST[:shosho], # 16
79
- LIST[:hakuro], # 17
80
- LIST[:shuubun], # 18
81
- LIST[:kanro], # 19
82
- LIST[:soukou], # 20
83
- LIST[:rittou], # 21
84
- LIST[:shousetsu], # 22
85
- LIST[:taisetsu] # 23
86
- ].freeze
87
- end
88
-
89
16
  #
90
17
  # 24気損益眺朒(ちょうじく)数
91
18
  #
@@ -153,118 +80,10 @@ module Zakuro
153
80
  }.freeze
154
81
  end
155
82
 
156
- #
157
- # 二十四節気 と 補正値 を計算する
158
- #
159
- # @param [SolarTerm] solar_term 二十四節気
160
- #
161
- # @return [SolarTerm] 二十四節気
162
- # @return [Integer] 補正値
163
- #
164
- def self.calc_term_and_orbit_value(solar_term:)
165
- remainder = calc_solar_term_by_remainder(
166
- solar_term: solar_term
167
- )
168
- value = calc_sun_orbit_value(
169
- solar_term: remainder
170
- )
171
- [remainder, value]
172
- end
173
-
174
- # :reek:ControlParameter and :reek:BooleanParameter
175
-
176
- #
177
- # 二十四節気を計算する
178
- #
179
- # @param [SolarTerm] solar_term 二十四節気
180
- #
181
- # @return [SolarTerm] 二十四節気
182
- #
183
- def self.calc_solar_term_by_remainder(solar_term:)
184
- if solar_term.index.negative?
185
- return calc_first_solar_term(
186
- winter_solstice_age: solar_term.remainder
187
- )
188
- end
189
-
190
- calc_next_solar_term_recursively(
191
- solar_term: solar_term
192
- )
193
- end
194
-
195
- # :reek:TooManyStatements { max_statements: 8 }
196
-
197
- #
198
- # 入定気(定気の開始点からの日時)と属する定気を計算する
199
- #
200
- # @param [Remainder] winter_solstice_age 天正冬至
201
- #
202
- # @return [SolarTerm] 二十四節気
203
- # SolarTerm.remainder : 入定気(定気の開始点からの日時)
204
- # SolarTerm.index : 定気
205
- #
206
- def self.calc_first_solar_term(winter_solstice_age:)
207
- # 入定気の起算方法
208
- # 概要:
209
- # * 太陽の運行による補正値は、二十四節気の気ごとに定められる
210
- # * 11月経朔の前にある気を求め、それから11月経朔との間隔を求める
211
- # * 気ごとの補正値と、気から11月経朔までにかかる補正値を求める
212
- # 前提:
213
- # * 11月経朔に関わる二十四節気は、時系列から順に、小雪・大雪・冬至である
214
- # * 小雪〜大雪の間隔は小雪定数で、大雪〜冬至の間隔は大雪定数で決められている(24気損益眺朒(ちょうじく)数のこと)
215
- # * 11月経朔は、この小雪〜冬至の間のいずれかにある
216
- # 計算:
217
- # 2パターンある
218
- # (a) 大雪〜冬至にある場合
219
- # *「大雪定数 >= 天正閏余」の場合を指す
220
- # * * NOTE 資料では「より大きい(>)」とされるが、大雪そのものの場合は大雪から起算すべき
221
- # * この場合は、大雪〜経朔の間隔を求める
222
- # (b) 小雪〜大雪にある場合
223
- # *「大雪定数 < 天正閏余」の場合を指す
224
- # * この場合は、小雪〜経朔の間隔を求める
225
- taisetsu = 23
226
- taisetsu_interval = Interval::INDEXES[taisetsu]
227
-
228
- if winter_solstice_age > taisetsu_interval
229
- # (b)
230
- shousetsu = 22
231
- diff = winter_solstice_age.sub(taisetsu_interval)
232
-
233
- return SolarTerm.new(remainder: Interval::INDEXES[shousetsu].sub(diff),
234
- index: shousetsu)
235
- end
236
- # (a)
237
- SolarTerm.new(remainder: taisetsu_interval.sub(winter_solstice_age),
238
- index: taisetsu)
239
- end
240
-
241
- # :reek:TooManyStatements { max_statements: 8 }
242
-
243
- #
244
- # 次の二十四節気を計算する
245
- #
246
- # @param [SolarTerm] solar_term 今回の二十四節気
247
- #
248
- # @return [SolarTerm] 次回の二十四節気
249
- #
250
- def self.calc_next_solar_term_recursively(solar_term:)
251
- remainder = solar_term.remainder
252
- index = solar_term.index
253
- interval = Interval::INDEXES[index]
254
- return solar_term if remainder < interval
255
-
256
- remainder.sub!(interval)
257
- index += 1
258
- index = 0 if index >= Interval::INDEXES.size
259
- calc_next_solar_term_recursively(
260
- solar_term: SolarTerm.new(remainder: remainder, index: index)
261
- )
262
- end
263
-
264
83
  #
265
84
  # 太陽の運行による補正値を算出する
266
85
  #
267
- # @param [SolarTerm] solar_term 二十四節気
86
+ # @param [SolarTerm] solar_term 入定気
268
87
  #
269
88
  # @return [Integer] 補正値
270
89
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zakuro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pldb
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: mainly lunar solar calendar
14
14
  email:
@@ -92,10 +92,13 @@ files:
92
92
  - lib/zakuro/version/senmyou/range/full_range.rb
93
93
  - lib/zakuro/version/senmyou/range/operated_range.rb
94
94
  - lib/zakuro/version/senmyou/range/operated_solar_terms.rb
95
+ - lib/zakuro/version/senmyou/range/western_date_allocation.rb
96
+ - lib/zakuro/version/senmyou/range/year_boundary.rb
95
97
  - lib/zakuro/version/senmyou/senmyou.rb
96
98
  - lib/zakuro/version/senmyou/specifier/single_day_specifier.rb
97
99
  - lib/zakuro/version/senmyou/stella/lunar_orbit.rb
98
100
  - lib/zakuro/version/senmyou/stella/solar_average.rb
101
+ - lib/zakuro/version/senmyou/stella/solar_location.rb
99
102
  - lib/zakuro/version/senmyou/stella/solar_orbit.rb
100
103
  - lib/zakuro/version/senmyou/stella/winter_solstice.rb
101
104
  - lib/zakuro/version/senmyou/summary/single.rb
@@ -111,7 +114,7 @@ metadata:
111
114
  homepage_uri: https://github.com/pldb/zakuro
112
115
  source_code_uri: https://github.com/pldb/zakuro
113
116
  changelog_uri: https://github.com/pldb/zakuro
114
- post_install_message:
117
+ post_install_message:
115
118
  rdoc_options: []
116
119
  require_paths:
117
120
  - lib
@@ -126,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
128
131
  requirements: []
129
- rubygems_version: 3.1.4
130
- signing_key:
132
+ rubygems_version: 3.1.2
133
+ signing_key:
131
134
  specification_version: 4
132
135
  summary: japanese calendar library.
133
136
  test_files: []