zakuro 0.1.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zakuro/calculation/base/multi_gengou.rb +101 -0
  3. data/lib/zakuro/calculation/base/multi_gengou_roller.rb +218 -0
  4. data/lib/zakuro/calculation/base/year.rb +107 -0
  5. data/lib/zakuro/calculation/cycle/abstract_remainder.rb +484 -0
  6. data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +173 -0
  7. data/lib/zakuro/calculation/cycle/zodiac.rb +106 -0
  8. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +169 -0
  9. data/lib/zakuro/calculation/monthly/first_day.rb +45 -0
  10. data/lib/zakuro/calculation/monthly/initialized_month.rb +125 -0
  11. data/lib/zakuro/calculation/monthly/month.rb +187 -0
  12. data/lib/zakuro/calculation/monthly/month_label.rb +88 -0
  13. data/lib/zakuro/calculation/monthly/operated_month.rb +209 -0
  14. data/lib/zakuro/calculation/range/full_range.rb +210 -0
  15. data/lib/zakuro/calculation/range/medieval_annual_range.rb +105 -0
  16. data/lib/zakuro/calculation/range/operated_range.rb +144 -0
  17. data/lib/zakuro/calculation/range/operated_solar_terms.rb +201 -0
  18. data/lib/zakuro/calculation/range/transfer/western_date_allocation.rb +82 -0
  19. data/lib/zakuro/calculation/range/transfer/year_boundary.rb +146 -0
  20. data/lib/zakuro/calculation/specifier/single_day.rb +109 -0
  21. data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +78 -0
  22. data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +71 -0
  23. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +117 -0
  24. data/lib/zakuro/calculation/stella/solar/abstract_location.rb +187 -0
  25. data/lib/zakuro/calculation/stella/solar/choukei_value.rb +136 -0
  26. data/lib/zakuro/calculation/summary/single.rb +129 -0
  27. data/lib/zakuro/calculation/type/old_float.rb +69 -0
  28. data/lib/zakuro/era/japan/reki.rb +1 -1
  29. data/lib/zakuro/merchant.rb +2 -2
  30. data/lib/zakuro/output/error.rb +7 -6
  31. data/lib/zakuro/output/logger.rb +50 -49
  32. data/lib/zakuro/output/response.rb +145 -144
  33. data/lib/zakuro/tools/typeof.rb +2 -2
  34. data/lib/zakuro/version.rb +1 -1
  35. data/lib/zakuro/version/abstract_version.rb +1 -1
  36. data/lib/zakuro/version/context.rb +23 -0
  37. data/lib/zakuro/version/daien/const/number.rb +55 -0
  38. data/lib/zakuro/version/daien/const/remainder.rb +53 -0
  39. data/lib/zakuro/version/daien/cycle/remainder.rb +59 -0
  40. data/lib/zakuro/version/daien/cycle/solar_term.rb +34 -0
  41. data/lib/zakuro/version/daien/daien.rb +36 -0
  42. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +106 -0
  43. data/lib/zakuro/version/daien/range/annual_range.rb +39 -0
  44. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +240 -0
  45. data/lib/zakuro/version/daien/stella/lunar/localization.rb +44 -0
  46. data/lib/zakuro/version/daien/stella/lunar/location.rb +80 -0
  47. data/lib/zakuro/version/daien/stella/lunar/value.rb +75 -0
  48. data/lib/zakuro/version/daien/stella/origin/average_november.rb +34 -0
  49. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +62 -0
  50. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +55 -0
  51. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +93 -0
  52. data/lib/zakuro/version/daien/stella/solar/average.rb +98 -0
  53. data/lib/zakuro/version/daien/stella/solar/interval.rb +108 -0
  54. data/lib/zakuro/version/daien/stella/solar/location.rb +61 -0
  55. data/lib/zakuro/version/daien/stella/solar/value.rb +36 -0
  56. data/lib/zakuro/version/gihou/const/number.rb +55 -0
  57. data/lib/zakuro/version/gihou/const/remainder.rb +54 -0
  58. data/lib/zakuro/version/gihou/cycle/remainder.rb +56 -0
  59. data/lib/zakuro/version/gihou/cycle/solar_term.rb +34 -0
  60. data/lib/zakuro/version/gihou/gihou.rb +23 -2
  61. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +106 -0
  62. data/lib/zakuro/version/gihou/range/annual_range.rb +39 -0
  63. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +250 -0
  64. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +44 -0
  65. data/lib/zakuro/version/gihou/stella/lunar/location.rb +80 -0
  66. data/lib/zakuro/version/gihou/stella/lunar/value.rb +75 -0
  67. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +34 -0
  68. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +62 -0
  69. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +55 -0
  70. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +93 -0
  71. data/lib/zakuro/version/gihou/stella/solar/average.rb +97 -0
  72. data/lib/zakuro/version/gihou/stella/solar/interval.rb +108 -0
  73. data/lib/zakuro/version/gihou/stella/solar/location.rb +61 -0
  74. data/lib/zakuro/version/gihou/stella/solar/value.rb +36 -0
  75. data/lib/zakuro/version/senmyou/const/number.rb +51 -0
  76. data/lib/zakuro/version/senmyou/const/remainder.rb +47 -0
  77. data/lib/zakuro/version/senmyou/cycle/remainder.rb +56 -0
  78. data/lib/zakuro/version/senmyou/cycle/solar_term.rb +34 -0
  79. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +80 -195
  80. data/lib/zakuro/version/senmyou/range/annual_range.rb +25 -145
  81. data/lib/zakuro/version/senmyou/senmyou.rb +10 -4
  82. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +237 -0
  83. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +44 -0
  84. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +87 -0
  85. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +67 -0
  86. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +34 -0
  87. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +62 -0
  88. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +55 -0
  89. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +93 -0
  90. data/lib/zakuro/version/senmyou/stella/solar/average.rb +97 -0
  91. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +103 -0
  92. data/lib/zakuro/version/senmyou/stella/solar/location.rb +61 -0
  93. data/lib/zakuro/version/senmyou/stella/solar/value.rb +39 -0
  94. data/lib/zakuro/version/version_class_resolver.rb +70 -0
  95. data/lib/zakuro/version_factory.rb +3 -3
  96. metadata +83 -28
  97. data/lib/zakuro/cycle/abstract_remainder.rb +0 -456
  98. data/lib/zakuro/cycle/zodiac.rb +0 -103
  99. data/lib/zakuro/version/senmyou/base/era.rb +0 -83
  100. data/lib/zakuro/version/senmyou/base/multi_gengou.rb +0 -98
  101. data/lib/zakuro/version/senmyou/base/multi_gengou_roller.rb +0 -217
  102. data/lib/zakuro/version/senmyou/base/remainder.rb +0 -60
  103. data/lib/zakuro/version/senmyou/base/solar_term.rb +0 -148
  104. data/lib/zakuro/version/senmyou/base/year.rb +0 -104
  105. data/lib/zakuro/version/senmyou/monthly/first_day.rb +0 -44
  106. data/lib/zakuro/version/senmyou/monthly/initialized_month.rb +0 -119
  107. data/lib/zakuro/version/senmyou/monthly/month.rb +0 -181
  108. data/lib/zakuro/version/senmyou/monthly/month_label.rb +0 -87
  109. data/lib/zakuro/version/senmyou/monthly/operated_month.rb +0 -196
  110. data/lib/zakuro/version/senmyou/range/full_range.rb +0 -194
  111. data/lib/zakuro/version/senmyou/range/operated_range.rb +0 -126
  112. data/lib/zakuro/version/senmyou/range/operated_solar_terms.rb +0 -181
  113. data/lib/zakuro/version/senmyou/range/western_date_allocation.rb +0 -68
  114. data/lib/zakuro/version/senmyou/range/year_boundary.rb +0 -138
  115. data/lib/zakuro/version/senmyou/specifier/single_day_specifier.rb +0 -102
  116. data/lib/zakuro/version/senmyou/stella/lunar_orbit.rb +0 -332
  117. data/lib/zakuro/version/senmyou/stella/solar_average.rb +0 -169
  118. data/lib/zakuro/version/senmyou/stella/solar_location.rb +0 -213
  119. data/lib/zakuro/version/senmyou/stella/solar_orbit.rb +0 -213
  120. data/lib/zakuro/version/senmyou/stella/winter_solstice.rb +0 -106
  121. data/lib/zakuro/version/senmyou/summary/single.rb +0 -125
  122. data/lib/zakuro/version/taien/taien.rb +0 -19
@@ -2,171 +2,172 @@
2
2
 
3
3
  require_relative '../result/result'
4
4
 
5
- # TODO: outputモジュール内にする
6
-
7
5
  # :nodoc:
8
6
  module Zakuro
9
- #
10
- # Response 返却値
11
- #
12
- module Response
7
+ # :nodoc:
8
+ module Output
13
9
  #
14
- # SingleDay 1日データ
10
+ # Response 返却値
15
11
  #
16
- module SingleDay
12
+ module Response
17
13
  #
18
- # Param 引数
14
+ # SingleDay 1日データ
19
15
  #
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
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
+ #
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),
60
+ month: save_month(month: month, date: date, days: days),
61
+ day: save_day(month: month, date: date, days: days)
62
+ )
63
+ end
29
64
 
30
65
  #
31
- # 初期化
66
+ # 年データを保存する
32
67
  #
33
68
  # @param [Year] year 年情報(各暦のデータ型)
69
+ #
70
+ # @return [Result::Year] 年データ
71
+ #
72
+ def self.save_year(year:)
73
+ multi_gengou = year.multi_gengou
74
+ first = multi_gengou.first_line
75
+ second = multi_gengou.second_line
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
85
+
86
+ #
87
+ # 月データを保存する
88
+ #
34
89
  # @param [Month] month 月情報(各暦のデータ型)
35
90
  # @param [Western::Calendar] date 年月日情報(西暦)
36
91
  # @param [Integer] days 日数(月初日から指定日までの日数)
37
92
  #
38
- def initialize(year:, month:, date:, days:)
39
- @year = year
40
- @month = month
41
- @date = date
42
- @days = days
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
+ )
43
103
  end
44
- end
45
-
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),
60
- month: save_month(month: month, date: date, days: days),
61
- day: save_day(month: month, date: date, days: days)
62
- )
63
- end
104
+ private_class_method :save_month
64
105
 
65
- #
66
- # 年データを保存する
67
- #
68
- # @param [Year] year 年情報(各暦のデータ型)
69
- #
70
- # @return [Result::Year] 年データ
71
- #
72
- def self.save_year(year:)
73
- multi_gengou = year.multi_gengou
74
- first = multi_gengou.first_line
75
- second = multi_gengou.second_line
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
85
-
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
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
105
125
 
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
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?
125
137
 
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?
138
+ [
139
+ Result::Data::SolarTerm.new(
140
+ index: term.index,
141
+ remainder: term.remainder
142
+ )
143
+ ]
144
+ end
145
+ private_class_method :save_solar_term
137
146
 
138
- [
139
- Result::Data::SolarTerm.new(
140
- index: term.index,
141
- remainder: term.remainder
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)
142
161
  )
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
- )
162
+ Result::Data::Day.new(
163
+ number: (days + 1),
164
+ zodiac_name: remainder.zodiac_name,
165
+ remainder: remainder,
166
+ western_date: date
167
+ )
168
+ end
169
+ private_class_method :save_day
168
170
  end
169
- private_class_method :save_day
170
171
  end
171
172
  end
172
173
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../cycle/abstract_remainder'
3
+ require_relative '../calculation/cycle/abstract_remainder'
4
4
  require_relative '../era/western'
5
5
 
6
6
  # :nodoc:
@@ -24,7 +24,7 @@ module Zakuro
24
24
  def self.time?(obj:)
25
25
  return true if obj.is_a?(Western::Calendar)
26
26
 
27
- return true if obj.is_a?(Cycle::AbstractRemainder)
27
+ return true if obj.is_a?(Calculation::Cycle::AbstractRemainder)
28
28
 
29
29
  false
30
30
  end
@@ -3,5 +3,5 @@
3
3
  # :nodoc:
4
4
  module Zakuro
5
5
  # @return [String] library version
6
- VERSION = '0.1.2'
6
+ VERSION = '0.3.0'
7
7
  end
@@ -17,7 +17,7 @@ module Zakuro
17
17
  #
18
18
  # @param [Date] western_date 西暦日
19
19
  #
20
- # @return [Result::SingleDay] 和暦日
20
+ # @return [Result::Single] 和暦日
21
21
  #
22
22
  # @raise [NotImplementedError] オーバーライドなし
23
23
  #
@@ -0,0 +1,23 @@
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
+ attr_reader :version_name
12
+ attr_reader :resolver
13
+
14
+ VERSION_NAMES = %w[Genka Gihou Daien Senmyou Joukyou Kansei Tenpou Gregorio].freeze
15
+
16
+ def initialize(version_name:)
17
+ raise ArgumentError.new, 'invalid version' unless VERSION_NAMES.include?(version_name)
18
+
19
+ @version_name = version_name
20
+ @resolver = VersionClassResolver.new(version_name: version_name)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nodoc:
4
+ module Zakuro
5
+ # :nodoc:
6
+ module Daien
7
+ #
8
+ # Const 定数
9
+ #
10
+ module Const
11
+ #
12
+ # Number 数値
13
+ #
14
+ module Number
15
+ #
16
+ # Cycle 周期
17
+ #
18
+ module Cycle
19
+ # @return [Integer] 通法(1日=3040分)
20
+ DAY = 3040
21
+ #
22
+ # @return [Float] 転日(1近点月 = 27日1685分79秒(1分=80秒))
23
+ # @note 小数点以下の値によって大幅に結果が変わる。除算結果を設定した
24
+ #
25
+ ANOMALISTIC_MONTH = 83_765 + (79.0 / 80)
26
+ # @return [Integer] 朔望月
27
+ SYNODIC_MONTH = 89_773
28
+ # @return [Integer] 一年
29
+ YEAR = 1_110_343
30
+ end
31
+
32
+ #
33
+ # Derivation 導出
34
+ #
35
+ module Derivation
36
+ # @return [Integer] 通余: (YEAR - DAY * 12 * 30)
37
+ # 1110343 - 1094400
38
+ REMAINDER_ALL_YEAR = 15_943
39
+ # @return [Integer] 旬周(60日) DAY * 60
40
+ SIXTY_DAYS = 182_400
41
+ end
42
+
43
+ #
44
+ # 累積
45
+ #
46
+ module Stack
47
+ # @return [Integer] 積年(甲子夜半朔旦冬至〜暦の開始前)
48
+ TOTAL_YEAR = 96_961_740
49
+ # @return [Integer] 暦の開始年(開元12年)
50
+ BEGIN_YEAR = 724
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../cycle/remainder'
4
+
5
+ # :nodoc:
6
+ module Zakuro
7
+ # :nodoc:
8
+ module Daien
9
+ #
10
+ # Const 定数
11
+ #
12
+ module Const
13
+ #
14
+ # Remainder 大余小余
15
+ #
16
+ module Remainder
17
+ #
18
+ # Solar 太陽
19
+ #
20
+ module Solar
21
+ # @return [Remainder] 気策(24分の1年)
22
+ # 1年(1_110_343) / 24 / 1日(3040)= 15 余り 664.2916666666642
23
+ # * 0.2916666666642 * 24(1分=24秒) = 6.999999999940799 ≒ 7
24
+ SOLAR_TERM_AVERAGE = Cycle::Remainder.new(day: 15, minute: 664, second: 7)
25
+ #
26
+ # @note 揲法 89773 = 29-1613
27
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
28
+ # * 0.25 * 24(1分=24秒) = 6
29
+ #
30
+ # @return [Cycle::Remainder] 弦(1分=80秒)
31
+ QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
32
+ end
33
+
34
+ #
35
+ # Lunar 月
36
+ #
37
+ module Lunar
38
+ # @return [Cycle::LunarRemainder] 転日(1近点月)
39
+ ANOMALISTIC_MONTH = \
40
+ Cycle::LunarRemainder.new(day: 27, minute: 1685, second: 79)
41
+ #
42
+ # @note 揲法 89773 = 29-1613
43
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
44
+ # * 0.25 * 80(1分=80秒) = 20
45
+ #
46
+ # @return [Cycle::LunarRemainder] 弦(1分=80秒)
47
+ # TODO: 秒が20では通らない。少なくとも0.01247は必要になる
48
+ QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20.01247)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end