zakuro 0.1.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/gengou.md +22 -22
- data/doc/operation/csv/month.csv +447 -202
- data/doc/operation/operation.xlsx +0 -0
- data/lib/zakuro/calculation/base/operated_year.rb +114 -0
- data/lib/zakuro/calculation/base/year.rb +3 -0
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +44 -19
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +169 -0
- data/lib/zakuro/calculation/monthly/first_day.rb +1 -1
- data/lib/zakuro/calculation/monthly/operated_month.rb +47 -3
- data/lib/zakuro/calculation/range/full_range.rb +1 -1
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +105 -0
- data/lib/zakuro/calculation/range/operated_range.rb +61 -16
- data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +78 -0
- data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +71 -0
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +117 -0
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +187 -0
- data/lib/zakuro/calculation/stella/solar/choukei_value.rb +136 -0
- data/lib/zakuro/calculation/type/old_float.rb +69 -0
- data/lib/zakuro/era/japan/reki.rb +1 -1
- data/lib/zakuro/era/japan/yaml/set-001-until-south.yaml +22 -22
- data/lib/zakuro/operation/month/type.rb +58 -0
- data/lib/zakuro/operation/yaml/month.yaml +7840 -0
- data/lib/zakuro/version/context.rb +1 -1
- data/lib/zakuro/version/daien/const/number.rb +55 -0
- data/lib/zakuro/version/daien/const/remainder.rb +53 -0
- data/lib/zakuro/version/daien/cycle/remainder.rb +59 -0
- data/lib/zakuro/version/daien/cycle/solar_term.rb +34 -0
- data/lib/zakuro/version/daien/daien.rb +36 -0
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +106 -0
- data/lib/zakuro/version/daien/range/annual_range.rb +39 -0
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +240 -0
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +44 -0
- data/lib/zakuro/version/daien/stella/lunar/location.rb +80 -0
- data/lib/zakuro/version/daien/stella/lunar/value.rb +75 -0
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +34 -0
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +62 -0
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +55 -0
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +93 -0
- data/lib/zakuro/version/daien/stella/solar/average.rb +98 -0
- data/lib/zakuro/version/daien/stella/solar/interval.rb +108 -0
- data/lib/zakuro/version/daien/stella/solar/location.rb +61 -0
- data/lib/zakuro/version/daien/stella/solar/value.rb +36 -0
- data/lib/zakuro/version/gihou/const/number.rb +55 -0
- data/lib/zakuro/version/gihou/const/remainder.rb +54 -0
- data/lib/zakuro/version/gihou/cycle/remainder.rb +56 -0
- data/lib/zakuro/version/gihou/cycle/solar_term.rb +34 -0
- data/lib/zakuro/version/gihou/gihou.rb +23 -2
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +106 -0
- data/lib/zakuro/version/gihou/range/annual_range.rb +39 -0
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +250 -0
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +44 -0
- data/lib/zakuro/version/gihou/stella/lunar/location.rb +80 -0
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +75 -0
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +34 -0
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +62 -0
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +55 -0
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +93 -0
- data/lib/zakuro/version/gihou/stella/solar/average.rb +97 -0
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +108 -0
- data/lib/zakuro/version/gihou/stella/solar/location.rb +61 -0
- data/lib/zakuro/version/gihou/stella/solar/value.rb +36 -0
- data/lib/zakuro/version/senmyou/const/number.rb +51 -0
- data/lib/zakuro/version/senmyou/const/remainder.rb +47 -0
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +5 -12
- data/lib/zakuro/version/senmyou/cycle/solar_term.rb +4 -1
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +36 -155
- data/lib/zakuro/version/senmyou/range/annual_range.rb +7 -135
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +237 -0
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +44 -0
- data/lib/zakuro/version/senmyou/stella/lunar/location.rb +87 -0
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +67 -0
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +34 -0
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +62 -0
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +55 -0
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +93 -0
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +97 -0
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +103 -0
- data/lib/zakuro/version/senmyou/stella/solar/location.rb +61 -0
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +39 -0
- data/lib/zakuro/version/version_class_resolver.rb +8 -0
- data/lib/zakuro/version.rb +1 -1
- data/lib/zakuro/version_factory.rb +1 -1
- metadata +62 -8
- data/lib/zakuro/version/senmyou/stella/lunar_orbit.rb +0 -332
- data/lib/zakuro/version/senmyou/stella/solar_average.rb +0 -169
- data/lib/zakuro/version/senmyou/stella/solar_location.rb +0 -213
- data/lib/zakuro/version/senmyou/stella/solar_orbit.rb +0 -213
- data/lib/zakuro/version/senmyou/stella/winter_solstice.rb +0 -106
- data/lib/zakuro/version/taien/taien.rb +0 -19
Binary file
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './year'
|
4
|
+
require_relative './multi_gengou'
|
5
|
+
|
6
|
+
# :nodoc:
|
7
|
+
module Zakuro
|
8
|
+
# :nodoc:
|
9
|
+
module Calculation
|
10
|
+
# :nodoc:
|
11
|
+
module Base
|
12
|
+
#
|
13
|
+
# OperatedYear 年(運用)
|
14
|
+
#
|
15
|
+
class OperatedYear < Year
|
16
|
+
#
|
17
|
+
# 初期化
|
18
|
+
#
|
19
|
+
# @param [Gengou] multi_gengou 元号
|
20
|
+
# @param [Array<OperatedMonth>] months 年内の全ての月
|
21
|
+
# @param [Integer] total_days 年の日数
|
22
|
+
# @param [Western::Calendar] new_year_date 元旦
|
23
|
+
#
|
24
|
+
def initialize(multi_gengou: MultiGengou.new, new_year_date: Western::Calendar.new,
|
25
|
+
months: [], total_days: 0)
|
26
|
+
super(multi_gengou: multi_gengou, new_year_date: new_year_date,
|
27
|
+
months: months, total_days: total_days)
|
28
|
+
end
|
29
|
+
|
30
|
+
def commit
|
31
|
+
super
|
32
|
+
|
33
|
+
return if months.empty?
|
34
|
+
|
35
|
+
@new_year_date = months[0].first_day.western_date
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# 引数を月の先頭に加える
|
40
|
+
#
|
41
|
+
# @param [Array<OperatedMonth>] first_months 先頭の月
|
42
|
+
#
|
43
|
+
def unshift_months(first_months)
|
44
|
+
# 逆順で加える
|
45
|
+
first_months.reverse_each do |month|
|
46
|
+
month.moved
|
47
|
+
months.unshift(month)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# 引数を月の最後に加える
|
53
|
+
#
|
54
|
+
# @param [Array<OperatedMonth>] last_months 最後の月
|
55
|
+
#
|
56
|
+
def push_months(last_months)
|
57
|
+
last_months.each do |month|
|
58
|
+
month.moved
|
59
|
+
months.push(month)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# 昨年に属する月を取り出す
|
65
|
+
#
|
66
|
+
# @return [Array<OperatedMonth>] 昨年に属する月
|
67
|
+
#
|
68
|
+
def shift_last_year_months
|
69
|
+
result, @months = OperatedYear.devide_with(method: :last_year?, arr: months)
|
70
|
+
|
71
|
+
result
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# 来年に属する月を取り出す
|
76
|
+
#
|
77
|
+
# @return [Array<OperatedMonth>] 来年に属する月
|
78
|
+
#
|
79
|
+
def pop_next_year_months
|
80
|
+
result, @months = OperatedYear.devide_with(method: :next_year?, arr: months)
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
# :reek:TooManyStatements { max_statements: 8 }
|
86
|
+
|
87
|
+
#
|
88
|
+
# メソッドで配列を分離する
|
89
|
+
#
|
90
|
+
# @param [Symbol] method 条件メソッド
|
91
|
+
# @param [Array<Object>] arr 配列
|
92
|
+
#
|
93
|
+
# @return [Array<Object>] 一致配列
|
94
|
+
# @return [Array<Object>] 不一致配列
|
95
|
+
#
|
96
|
+
def self.devide_with(method:, arr: [])
|
97
|
+
match = []
|
98
|
+
unmatch = []
|
99
|
+
|
100
|
+
arr.each do |item|
|
101
|
+
if !item.moved? && item.send(method)
|
102
|
+
match.push(item)
|
103
|
+
next
|
104
|
+
end
|
105
|
+
|
106
|
+
unmatch.push(item)
|
107
|
+
end
|
108
|
+
|
109
|
+
[match, unmatch]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -25,6 +25,9 @@ module Zakuro
|
|
25
25
|
# 初期化
|
26
26
|
#
|
27
27
|
# @param [Gengou] multi_gengou 元号
|
28
|
+
# @param [Array<Month>] months 年内の全ての月
|
29
|
+
# @param [Integer] total_days 年の日数
|
30
|
+
# @param [Western::Calendar] new_year_date 元旦
|
28
31
|
#
|
29
32
|
def initialize(multi_gengou: MultiGengou.new, new_year_date: Western::Calendar.new,
|
30
33
|
months: [], total_days: 0)
|
@@ -10,6 +10,11 @@ module Zakuro
|
|
10
10
|
# 大余小余(時刻情報)
|
11
11
|
# @abstract 大余小余計算に必要な処理を行う、暦に依存しない汎用的なクラス
|
12
12
|
#
|
13
|
+
# * 十干十二支(60日)を上限とした「日時分秒」の情報で、日付(date)/時刻(time)と部分的に重なる概念
|
14
|
+
# * 「15日1012分5秒」のような形式で表される
|
15
|
+
# * 分の上限で大余に繰り上げる
|
16
|
+
# * 秒の上限で1分に繰り上げる
|
17
|
+
#
|
13
18
|
class AbstractRemainder # rubocop:disable Metrics/ClassLength
|
14
19
|
# @return [Integer] 大余上限
|
15
20
|
LIMIT = 60
|
@@ -224,8 +229,7 @@ module Zakuro
|
|
224
229
|
# @return [False] より小さい
|
225
230
|
#
|
226
231
|
def >=(other)
|
227
|
-
up?(other) ||
|
228
|
-
(@day == other.day && @minute == other.minute && @second == other.second)
|
232
|
+
up?(other) || eql?(other)
|
229
233
|
end
|
230
234
|
|
231
235
|
#
|
@@ -249,8 +253,7 @@ module Zakuro
|
|
249
253
|
# @return [False] より大きい
|
250
254
|
#
|
251
255
|
def <=(other)
|
252
|
-
down?(other) ||
|
253
|
-
(@day == other.day && @minute == other.minute && @second == other.second)
|
256
|
+
down?(other) || eql?(other)
|
254
257
|
end
|
255
258
|
|
256
259
|
#
|
@@ -331,6 +334,27 @@ module Zakuro
|
|
331
334
|
@day * @base_day + @minute
|
332
335
|
end
|
333
336
|
|
337
|
+
#
|
338
|
+
# 小余(秒切り捨て)を返す
|
339
|
+
#
|
340
|
+
# @note 切り捨て前に繰り上げる
|
341
|
+
#
|
342
|
+
# @return [Integer] 小余(秒切り捨て)
|
343
|
+
#
|
344
|
+
def floor_minute
|
345
|
+
result = float_minute
|
346
|
+
result.floor
|
347
|
+
end
|
348
|
+
|
349
|
+
#
|
350
|
+
# 秒を含めた小余を返す
|
351
|
+
#
|
352
|
+
# @return [Float] 小余
|
353
|
+
#
|
354
|
+
def float_minute
|
355
|
+
@minute + @second.to_f / @base_minute
|
356
|
+
end
|
357
|
+
|
334
358
|
#
|
335
359
|
# 大余に四捨五入した結果を返す(秒は除外する)
|
336
360
|
#
|
@@ -365,14 +389,19 @@ module Zakuro
|
|
365
389
|
super(form, @day, @minute, @second)
|
366
390
|
end
|
367
391
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
392
|
+
#
|
393
|
+
# 繰り上げる
|
394
|
+
#
|
395
|
+
# @return [AbstractRemainder] 繰り上げ結果
|
396
|
+
#
|
397
|
+
def carry!
|
398
|
+
@day, @minute, @second = carry(@day, @minute, @second)
|
372
399
|
|
373
400
|
self
|
374
401
|
end
|
375
402
|
|
403
|
+
private
|
404
|
+
|
376
405
|
# 繰り上げ、繰り下げ
|
377
406
|
def carry(param_day, param_minute, param_second)
|
378
407
|
# NOTE: 計算方法としてマイナスでも徐算・剰余算の結果をプラス同様に扱う
|
@@ -425,33 +454,29 @@ module Zakuro
|
|
425
454
|
def up?(other)
|
426
455
|
invalid?(param: other)
|
427
456
|
day = other.day
|
428
|
-
minute = other.
|
457
|
+
minute = other.float_minute
|
458
|
+
|
429
459
|
return true if @day > day
|
430
460
|
return false if @day < day
|
431
461
|
|
432
|
-
|
433
|
-
return false if @minute < minute
|
434
|
-
|
435
|
-
@second > other.second
|
462
|
+
float_minute > minute
|
436
463
|
end
|
437
464
|
|
438
465
|
def eql?(other)
|
439
466
|
invalid?(param: other)
|
440
467
|
|
441
|
-
(@day == other.day &&
|
468
|
+
(@day == other.day && float_minute == other.float_minute)
|
442
469
|
end
|
443
470
|
|
444
471
|
def down?(other)
|
445
472
|
invalid?(param: other)
|
446
473
|
day = other.day
|
447
|
-
minute = other.
|
474
|
+
minute = other.float_minute
|
475
|
+
|
448
476
|
return true if @day < day
|
449
477
|
return false if @day > day
|
450
478
|
|
451
|
-
|
452
|
-
return false if @minute > minute
|
453
|
-
|
454
|
-
@second < other.second
|
479
|
+
float_minute < minute
|
455
480
|
end
|
456
481
|
end
|
457
482
|
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../output/logger'
|
4
|
+
|
5
|
+
# :nodoc:
|
6
|
+
module Zakuro
|
7
|
+
# :nodoc:
|
8
|
+
module Calculation
|
9
|
+
# :nodoc:
|
10
|
+
module Monthly
|
11
|
+
#
|
12
|
+
# AbstractLunarPhase 月の位相
|
13
|
+
#
|
14
|
+
class AbstractLunarPhase
|
15
|
+
# @return [Output::Logger] ロガー
|
16
|
+
LOGGER = Output::Logger.new(location: 'lunar_phase')
|
17
|
+
|
18
|
+
# @return [Array<String>] 月内の弦
|
19
|
+
PHASE_INDEXES = %w[朔日 上弦 望月 下弦].freeze
|
20
|
+
|
21
|
+
# @return [Cycle::AbstractRemainder] 経
|
22
|
+
attr_reader :average_remainder
|
23
|
+
# @return [Solar::AbstractLocation] 入定気
|
24
|
+
attr_reader :solar_location
|
25
|
+
# @return [Lunar::AbstractLocation] 入暦
|
26
|
+
attr_reader :lunar_location
|
27
|
+
# @return [Integer] 弦の位置
|
28
|
+
attr_reader :index
|
29
|
+
|
30
|
+
#
|
31
|
+
# 初期化
|
32
|
+
#
|
33
|
+
# @param [Cycle::AbstractRemainder] quater 弦
|
34
|
+
# @param [Solar::AbstractLocation] average_remainder 経
|
35
|
+
# @param [Solar::AbstractLocation] solar_location 入定気
|
36
|
+
# @param [Lunar::AbstractLocation] lunar_location 入暦
|
37
|
+
#
|
38
|
+
def initialize(quater:, average_remainder:, solar_location:, lunar_location:)
|
39
|
+
# 弦
|
40
|
+
@quarter = quater
|
41
|
+
# 経
|
42
|
+
@average_remainder = average_remainder
|
43
|
+
# 入定気
|
44
|
+
@solar_location = solar_location
|
45
|
+
# 入暦
|
46
|
+
@lunar_location = lunar_location
|
47
|
+
|
48
|
+
# 弦の位置
|
49
|
+
@index = 0
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# 次の弦に進める
|
54
|
+
#
|
55
|
+
# @return [Remainder] 定朔
|
56
|
+
#
|
57
|
+
def next_phase
|
58
|
+
adjusted = current_remainder
|
59
|
+
|
60
|
+
add_quarter_moon_size
|
61
|
+
|
62
|
+
adjusted
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# 次の月に進める
|
67
|
+
# @note 進めた後の月の定朔ではなく、当月のものを返却する
|
68
|
+
#
|
69
|
+
# @return [Remainder] 当月初の定朔
|
70
|
+
#
|
71
|
+
def next_month
|
72
|
+
result = nil
|
73
|
+
PHASE_INDEXES.each_with_index do |_phase, index|
|
74
|
+
adjust = next_phase
|
75
|
+
result = adjust if index.zero?
|
76
|
+
end
|
77
|
+
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
#
|
84
|
+
# 次の弦に進める
|
85
|
+
#
|
86
|
+
# @return [Integer] 弦
|
87
|
+
#
|
88
|
+
def next_index
|
89
|
+
@index += 1
|
90
|
+
@index = 0 if @index >= PHASE_INDEXES.size
|
91
|
+
@index
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# 朔月(月初)であるか
|
96
|
+
#
|
97
|
+
# @return [True] 朔月である
|
98
|
+
# @return [False] 朔月ではない
|
99
|
+
#
|
100
|
+
def first_phase?
|
101
|
+
@index.zero?
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# 朔月のみログ出力する
|
106
|
+
#
|
107
|
+
# @param [String] messages メッセージ(可変長)
|
108
|
+
#
|
109
|
+
def debug(*messages)
|
110
|
+
# 全ての弦を対象にするためコメントアウトする
|
111
|
+
# return unless first_phase?
|
112
|
+
|
113
|
+
LOGGER.debug(*messages)
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# 現在の定朔を取得する
|
118
|
+
#
|
119
|
+
# @return [Remainder] 定朔
|
120
|
+
#
|
121
|
+
def current_remainder
|
122
|
+
# abstract
|
123
|
+
end
|
124
|
+
|
125
|
+
#
|
126
|
+
# 補正値を得る
|
127
|
+
#
|
128
|
+
# @return [Integer] 補正値
|
129
|
+
#
|
130
|
+
def correction_value
|
131
|
+
sun = correction_solar_value
|
132
|
+
moon = correction_moon_value
|
133
|
+
|
134
|
+
sum = sun + moon
|
135
|
+
|
136
|
+
debug("sun: #{sun}", "moon: #{moon}", "sun + moon : #{sum}")
|
137
|
+
|
138
|
+
sum
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
142
|
+
# 太陽運動の補正値を得る
|
143
|
+
#
|
144
|
+
# @return [Integer] 太陽運動の補正値
|
145
|
+
#
|
146
|
+
def correction_solar_value
|
147
|
+
# abstract
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# 月運動の補正値を得る
|
152
|
+
#
|
153
|
+
# @return [Integer] 月運動の補正値
|
154
|
+
#
|
155
|
+
def correction_moon_value
|
156
|
+
# abstract
|
157
|
+
end
|
158
|
+
|
159
|
+
def add_quarter_moon_size
|
160
|
+
@average_remainder.add!(@quarter)
|
161
|
+
@solar_location.add_quarter
|
162
|
+
@lunar_location.add_quarter
|
163
|
+
|
164
|
+
next_index
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -23,7 +23,7 @@ module Zakuro
|
|
23
23
|
# @param [Remainder] remainder 西暦日
|
24
24
|
# @param [Western::Calendar] western_date 大余小余
|
25
25
|
#
|
26
|
-
def initialize(western_date: Western::Calendar.new, remainder:
|
26
|
+
def initialize(western_date: Western::Calendar.new, remainder:)
|
27
27
|
# 西暦日
|
28
28
|
@western_date = western_date
|
29
29
|
# 大余小余
|
@@ -9,7 +9,7 @@ module Zakuro
|
|
9
9
|
module Calculation
|
10
10
|
# :nodoc:
|
11
11
|
module Monthly
|
12
|
-
# :reek:TooManyInstanceVariables { max_instance_variables:
|
12
|
+
# :reek:TooManyInstanceVariables { max_instance_variables: 6 }
|
13
13
|
|
14
14
|
#
|
15
15
|
# OperatedMonth 月情報(運用)
|
@@ -40,6 +40,7 @@ module Zakuro
|
|
40
40
|
solar_terms: solar_terms)
|
41
41
|
@history = history
|
42
42
|
@operated_solar_terms = operated_solar_terms
|
43
|
+
@moved = false
|
43
44
|
end
|
44
45
|
|
45
46
|
# rubocop:enable Metrics/ParameterLists
|
@@ -99,9 +100,9 @@ module Zakuro
|
|
99
100
|
end
|
100
101
|
|
101
102
|
#
|
102
|
-
#
|
103
|
+
# 運用情報によって改変した二十四節気を作成する
|
103
104
|
#
|
104
|
-
# @param [<Type>] operated_solar_term
|
105
|
+
# @param [<Type>] operated_solar_term 運用情報(二十四節気)
|
105
106
|
# @param [Array<SolarTerm>] solar_terms 二十四節気
|
106
107
|
#
|
107
108
|
# @return [Array<SolarTerm>] 二十四節気
|
@@ -203,6 +204,49 @@ module Zakuro
|
|
203
204
|
|
204
205
|
western_date
|
205
206
|
end
|
207
|
+
|
208
|
+
#
|
209
|
+
# 運用情報では昨年の月か
|
210
|
+
#
|
211
|
+
# @return [True] 昨年の月
|
212
|
+
# @return [False] 今年/来年の月
|
213
|
+
#
|
214
|
+
def last_year?
|
215
|
+
history_month_number.last_year?
|
216
|
+
end
|
217
|
+
|
218
|
+
#
|
219
|
+
# 運用情報では来年の月か
|
220
|
+
#
|
221
|
+
# @return [True] 来年の月
|
222
|
+
# @return [False] 今年/昨年の月
|
223
|
+
#
|
224
|
+
def next_year?
|
225
|
+
history_month_number.next_year?
|
226
|
+
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# 別の年に移動したか
|
230
|
+
#
|
231
|
+
# @return [True] 移動済
|
232
|
+
# @return [False] 移動なし
|
233
|
+
#
|
234
|
+
def moved?
|
235
|
+
@moved
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# 移動済とする
|
240
|
+
#
|
241
|
+
def moved
|
242
|
+
@moved = true
|
243
|
+
end
|
244
|
+
|
245
|
+
private
|
246
|
+
|
247
|
+
def history_month_number
|
248
|
+
@history.diffs.month.number
|
249
|
+
end
|
206
250
|
end
|
207
251
|
end
|
208
252
|
end
|