zakuro 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -160
  3. data/VERSION +1 -1
  4. data/doc/condition.md +36 -0
  5. data/doc/dropped_date.md +41 -0
  6. data/doc/expection.md +108 -0
  7. data/doc/usage.md +120 -0
  8. data/doc/vanished_date.md +86 -0
  9. data/doc/version/daien.md +163 -0
  10. data/doc/version/genka.md +116 -0
  11. data/doc/version/gihou.md +172 -0
  12. data/doc/version/section/common_post_process.md +60 -0
  13. data/doc/version/section/common_pre_process.md +185 -0
  14. data/doc/version/section/const.md +45 -0
  15. data/doc/version/section/decimal.md +101 -0
  16. data/doc/version/section/lunisolar_calendar.md +55 -0
  17. data/doc/version/section/senmyou_november_1st.md +41 -0
  18. data/{lib/zakuro/version/senmyou/README.md → doc/version/senmyou.md} +15 -168
  19. data/lib/zakuro/calculation/cycle/abstract_remainder.rb +58 -0
  20. data/lib/zakuro/calculation/monthly/first_day.rb +9 -1
  21. data/lib/zakuro/calculation/option/vanished_date/abstract_parameter.rb +40 -0
  22. data/lib/zakuro/calculation/option/vanished_date/location.rb +84 -0
  23. data/lib/zakuro/calculation/range/medieval_annual_range.rb +5 -3
  24. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +1 -0
  25. data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +6 -2
  26. data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +14 -0
  27. data/lib/zakuro/calculation/summary/internal/option.rb +59 -4
  28. data/lib/zakuro/context/option.rb +17 -0
  29. data/lib/zakuro/context/version_class_resolver.rb +17 -1
  30. data/lib/zakuro/result/data/option/vanished_date/calculation.rb +45 -0
  31. data/lib/zakuro/result/data/option/vanished_date/option.rb +47 -0
  32. data/lib/zakuro/result/data/single_day.rb +2 -0
  33. data/lib/zakuro/version/daien/const/number.rb +2 -0
  34. data/lib/zakuro/version/daien/const/remainder.rb +7 -2
  35. data/lib/zakuro/version/daien/cycle/remainder.rb +38 -20
  36. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +2 -4
  37. data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +5 -3
  38. data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +33 -0
  39. data/lib/zakuro/version/daien/stella/lunar/location.rb +5 -8
  40. data/lib/zakuro/version/genka/cycle/remainder.rb +6 -2
  41. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +14 -3
  42. data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +31 -0
  43. data/lib/zakuro/version/gihou/const/remainder.rb +1 -5
  44. data/lib/zakuro/version/gihou/cycle/remainder.rb +0 -26
  45. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +2 -4
  46. data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +31 -0
  47. data/lib/zakuro/version/gihou/stella/lunar/location.rb +5 -8
  48. data/lib/zakuro/version/senmyou/const/number.rb +3 -1
  49. data/lib/zakuro/version/senmyou/const/remainder.rb +4 -2
  50. data/lib/zakuro/version/senmyou/cycle/remainder.rb +17 -34
  51. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +5 -5
  52. data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +33 -0
  53. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +6 -8
  54. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +9 -0
  55. metadata +24 -3
@@ -3,8 +3,10 @@
3
3
  require_relative '../../../context/option'
4
4
  require_relative '../../../result/data/option/dropped_date/option'
5
5
  require_relative '../../../result/data/solar_term'
6
+ require_relative '../../../result/data/option/vanished_date/option'
6
7
 
7
8
  require_relative '../../option/dropped_date/location'
9
+ require_relative '../../option/vanished_date/location'
8
10
 
9
11
  # :nodoc:
10
12
  module Zakuro
@@ -26,6 +28,8 @@ module Zakuro
26
28
  # @return [Hash<String, Result::Data::Option::AbstractOption>] オプション結果
27
29
  #
28
30
  def create(month:, day:)
31
+ # TODO: refactor
32
+
29
33
  options = {}
30
34
  context = month.context
31
35
 
@@ -38,6 +42,15 @@ module Zakuro
38
42
  options[Context::Option::DROPPED_DATE_KEY] = option
39
43
  end
40
44
 
45
+ if context.option.vanished_date?
46
+ remainder = day.remainder
47
+ average_remainder = month.first_day.average_remainder
48
+ option = vanished_date(
49
+ context: context, remainder: remainder, average_remainder: average_remainder
50
+ )
51
+ options[Context::Option::VANISHED_DATE_KEY] = option
52
+ end
53
+
41
54
  options
42
55
  end
43
56
 
@@ -53,10 +66,7 @@ module Zakuro
53
66
  # @return [Result::Data::Option::DroppedDate::Option] 没日
54
67
  #
55
68
  def dropped_date(context:, remainder:, solar_terms:)
56
- option = Result::Data::Option::DroppedDate::Option.new(
57
- matched: false,
58
- calculation: Result::Data::Option::DroppedDate::Calculation.new
59
- )
69
+ option = Result::Data::Option::DroppedDate::Option.new
60
70
 
61
71
  return option if remainder.invalid?
62
72
 
@@ -94,6 +104,51 @@ module Zakuro
94
104
  )
95
105
  )
96
106
  end
107
+
108
+ #
109
+ # 滅日を求める
110
+ #
111
+ # @param [<Type>] context <description>
112
+ # @param [<Type>] remainder <description>
113
+ # @param [<Type>] average_remainder <description>
114
+ #
115
+ # @return [<Type>] <description>
116
+ #
117
+ def vanished_date(context:, remainder:, average_remainder:)
118
+ option = Result::Data::Option::VanishedDate::Option.new
119
+
120
+ return option if average_remainder.invalid?
121
+
122
+ location = Calculation::Option::VanishedDate::Location.new(
123
+ context: context, average_remainder: average_remainder
124
+ )
125
+
126
+ return option unless location.exist?
127
+
128
+ vanished_date = location.get
129
+
130
+ return option unless remainder.day == vanished_date.day
131
+
132
+ vanished_date_option(location: location)
133
+ end
134
+
135
+ #
136
+ # 滅日オプション値を生成する
137
+ #
138
+ # @param [Calculation::Option::DroppedDate::Location] location 滅日位置
139
+ #
140
+ # @return [Result::Data::Option::DroppedDate::Option] 滅日オプション値
141
+ #
142
+ def vanished_date_option(location:)
143
+ vanished_date = location.get
144
+ Result::Data::Option::VanishedDate::Option.new(
145
+ matched: true,
146
+ calculation: Result::Data::Option::VanishedDate::Calculation.new(
147
+ remainder: vanished_date.format,
148
+ average_remainder: location.average_remainder
149
+ )
150
+ )
151
+ end
97
152
  end
98
153
  end
99
154
  end
@@ -16,6 +16,9 @@ module Zakuro
16
16
  # @return [String] 没日オプションキー名
17
17
  DROPPED_DATE_KEY = 'dropped_date'
18
18
 
19
+ # @return [String] 滅日オプションキー名
20
+ VANISHED_DATE_KEY = 'vanished_date'
21
+
19
22
  # @return [Hash<String, Object>] オプション値
20
23
  attr_reader :hash
21
24
  # @return [String] デフォルト暦名
@@ -82,6 +85,20 @@ module Zakuro
82
85
  false
83
86
  end
84
87
 
88
+ #
89
+ # 滅日か
90
+ #
91
+ # @return [True] 滅日あり
92
+ # @return [False] 滅日なし
93
+ #
94
+ def vanished_date?
95
+ value = @hash[VANISHED_DATE_KEY]
96
+
97
+ return true if value.is_a?(TrueClass)
98
+
99
+ false
100
+ end
101
+
85
102
  class << self
86
103
  #
87
104
  # 暦名を返す
@@ -4,21 +4,25 @@ require_relative '../version/genka/cycle/remainder'
4
4
  require_relative '../version/genka/cycle/solar_term'
5
5
  require_relative '../version/genka/range/annual_range'
6
6
  require_relative '../version/genka/option/dropped_date/parameter'
7
+ require_relative '../version/genka/option/vanished_date/parameter'
7
8
 
8
9
  require_relative '../version/gihou/cycle/remainder'
9
10
  require_relative '../version/gihou/cycle/solar_term'
10
11
  require_relative '../version/gihou/range/annual_range'
11
12
  require_relative '../version/gihou/option/dropped_date/parameter'
13
+ require_relative '../version/gihou/option/vanished_date/parameter'
12
14
 
13
15
  require_relative '../version/daien/cycle/remainder'
14
16
  require_relative '../version/daien/cycle/solar_term'
15
17
  require_relative '../version/daien/range/annual_range'
16
18
  require_relative '../version/daien/option/dropped_date/parameter'
19
+ require_relative '../version/daien/option/vanished_date/parameter'
17
20
 
18
21
  require_relative '../version/senmyou/cycle/remainder'
19
22
  require_relative '../version/senmyou/cycle/solar_term'
20
23
  require_relative '../version/senmyou/range/annual_range'
21
24
  require_relative '../version/senmyou/option/dropped_date/parameter'
25
+ require_relative '../version/senmyou/option/vanished_date/parameter'
22
26
 
23
27
  # :nodoc:
24
28
  module Zakuro
@@ -36,7 +40,8 @@ module Zakuro
36
40
  'remainder' => 'Zakuro::$VERSION::Cycle::Remainder',
37
41
  'solar_term' => 'Zakuro::$VERSION::Cycle::SolarTerm',
38
42
  'annual_range' => 'Zakuro::$VERSION::Range::AnnualRange',
39
- 'dropped_date_parameter' => 'Zakuro::$VERSION::Option::DroppedDate::Parameter'
43
+ 'dropped_date_parameter' => 'Zakuro::$VERSION::Option::DroppedDate::Parameter',
44
+ 'vanished_date_parameter' => 'Zakuro::$VERSION::Option::VanishedDate::Parameter'
40
45
  }.freeze
41
46
 
42
47
  #
@@ -86,6 +91,17 @@ module Zakuro
86
91
  )
87
92
  end
88
93
 
94
+ #
95
+ # 滅日引数を返す
96
+ #
97
+ # @return [Class] 没日引数クラス
98
+ #
99
+ def vanished_date_parameter
100
+ self.class.get_class(
101
+ version_name: @version_name, class_name: 'vanished_date_parameter'
102
+ )
103
+ end
104
+
89
105
  class << self
90
106
  #
91
107
  # 該当の暦のクラスを取得する
@@ -0,0 +1,45 @@
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
+ # VanishedDate 滅日
19
+ #
20
+ module VanishedDate
21
+ #
22
+ # Calculation 演算値
23
+ #
24
+ class Calculation
25
+ # @return [String] 大余小余(滅余)
26
+ attr_reader :remainder
27
+ # @return [String] 経朔
28
+ attr_reader :average_remainder
29
+
30
+ #
31
+ # 初期化
32
+ #
33
+ # @param [String] remainder 大余小余(滅余)
34
+ # @param [String] average_remainder 経朔
35
+ #
36
+ def initialize(remainder: '', average_remainder: '')
37
+ @remainder = remainder
38
+ @average_remainder = average_remainder
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ 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
+ # VanishedDate 滅日
23
+ #
24
+ module VanishedDate
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
@@ -6,6 +6,8 @@ require_relative './option/abstract_option'
6
6
 
7
7
  require_relative './option/dropped_date/option'
8
8
 
9
+ require_relative './option/vanished_date/option'
10
+
9
11
  require_relative 'year'
10
12
 
11
13
  require_relative 'month'
@@ -38,6 +38,8 @@ module Zakuro
38
38
  REMAINDER_ALL_YEAR = 15_943
39
39
  # @return [Integer] 旬周(60日) DAY * 60
40
40
  SIXTY_DAYS = 182_400
41
+ # @return [Integer] 朔虚分: (30 * 3040) % (29 * 3040 + 1613)
42
+ REMAINDER_IDEAL_MONTH = 1427
41
43
  end
42
44
 
43
45
  #
@@ -29,6 +29,12 @@ module Zakuro
29
29
  #
30
30
  # @return [Cycle::Remainder] 弦(1分=80秒)
31
31
  QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
32
+
33
+ # @return [Cycle::Remainder] 有没判定
34
+ DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
35
+
36
+ # @return [Cycle::Remainder] 有滅判定
37
+ VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
32
38
  end
33
39
 
34
40
  #
@@ -44,8 +50,7 @@ module Zakuro
44
50
  # * 0.25 * 80(1分=80秒) = 20
45
51
  #
46
52
  # @return [Cycle::LunarRemainder] 弦(1分=80秒)
47
- # TODO: 秒が20では通らない。少なくとも0.01247は必要になる
48
- QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20.01247)
53
+ QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
49
54
  end
50
55
  end
51
56
  end
@@ -32,19 +32,6 @@ module Zakuro
32
32
  super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
33
33
  day: day, minute: minute, second: second, total: total)
34
34
  end
35
-
36
- #
37
- # 特定の文字フォーマットにして出力する
38
- #
39
- # @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
40
- #
41
- # @return [String] フォーマットした結果
42
- #
43
- def format(form: '%d-%d')
44
- return '' if invalid?
45
-
46
- super(form, @day, @minute, @second)
47
- end
48
35
  end
49
36
 
50
37
  #
@@ -66,18 +53,49 @@ module Zakuro
66
53
  super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
67
54
  day: day, minute: minute, second: second, total: total)
68
55
  end
56
+ end
57
+
58
+ #
59
+ # DroppedRemainder 没日の計算向け時刻情報(没余)
60
+ #
61
+ class DroppedRemainder < Calculation::Cycle::AbstractRemainder
62
+ # @return [Integer] 分(1分=24秒)
63
+ MINUTE = 24
69
64
 
70
65
  #
71
- # 特定の文字フォーマットにして出力する
72
- #
73
- # @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
66
+ # 初期化
74
67
  #
75
- # @return [String] フォーマットした結果
68
+ # @param [Integer] day 大余("日"に相当)
69
+ # @param [Integer] minute 小余("分"に相当)
70
+ # @param [Integer] second 秒
71
+ # @param [Integer] total 繰り上げなしの小余
76
72
  #
77
- def format(form: '%d-%d')
78
- return '' if invalid?
73
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
74
+ # 小余 = 通余
75
+ super(base_day: Const::Number::Derivation::REMAINDER_ALL_YEAR, base_minute: MINUTE,
76
+ day: day, minute: minute, second: second, total: total)
77
+ end
78
+ end
79
+
80
+ #
81
+ # VanishedRemainder 滅日の計算向け時刻情報(滅余)
82
+ #
83
+ class VanishedRemainder < Calculation::Cycle::AbstractRemainder
84
+ # @return [Integer] 分(1分=24秒)
85
+ MINUTE = 24
79
86
 
80
- super(form, @day, @minute, @second)
87
+ #
88
+ # 初期化
89
+ #
90
+ # @param [Integer] day 大余("日"に相当)
91
+ # @param [Integer] minute 小余("分"に相当)
92
+ # @param [Integer] second 秒
93
+ # @param [Integer] total 繰り上げなしの小余
94
+ #
95
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
96
+ # 小余 = 朔虚分
97
+ super(base_day: Const::Number::Derivation::REMAINDER_IDEAL_MONTH, base_minute: MINUTE,
98
+ day: day, minute: minute, second: second, total: total)
81
99
  end
82
100
  end
83
101
  end
@@ -64,7 +64,7 @@ module Zakuro
64
64
  # NOTE: 大衍暦では進朔しない
65
65
  # adjusted.up_on_new_moon!
66
66
 
67
- debug("result: #{adjusted.format}")
67
+ debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
68
68
 
69
69
  adjusted
70
70
  end
@@ -92,9 +92,7 @@ module Zakuro
92
92
 
93
93
  remainder = lunar_location.adjusted_remainder
94
94
 
95
- # debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
96
- # debug("[lunar]remainder.day: #{remainder.day}")
97
- # debug("[lunar]remainder.minute: #{remainder.minute}")
95
+ debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
98
96
 
99
97
  Lunar::Value.get(remainder: remainder)
100
98
  end
@@ -9,9 +9,9 @@ require_relative '../../cycle/remainder'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Senmyou
12
+ module Daien
13
13
  # :nodoc:
14
- module Daien
14
+ module Option
15
15
  # :nodoc:
16
16
  module DroppedDate
17
17
  #
@@ -22,7 +22,9 @@ module Zakuro
22
22
  # 初期化
23
23
  #
24
24
  def initialize
25
- super(valid: false)
25
+ super(valid: true, year: Const::Number::Cycle::YEAR,
26
+ limit: Const::Remainder::Solar::DROPPED_DATE_LIMIT,
27
+ remainder_class: Cycle::DroppedRemainder)
26
28
  end
27
29
  end
28
30
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../../calculation/option/vanished_date/abstract_parameter'
4
+
5
+ require_relative '../../const/number'
6
+ require_relative '../../const/remainder'
7
+ require_relative '../../cycle/remainder'
8
+
9
+ # :nodoc:
10
+ module Zakuro
11
+ # :nodoc:
12
+ module Daien
13
+ # :nodoc:
14
+ module Option
15
+ # :nodoc:
16
+ module VanishedDate
17
+ #
18
+ # Parameter 引数
19
+ #
20
+ class Parameter < Calculation::Option::VanishedDate::AbstractParameter
21
+ #
22
+ # 初期化
23
+ #
24
+ def initialize
25
+ super(valid: true,
26
+ limit: Const::Remainder::Solar::VANISHED_DATE_LIMIT,
27
+ remainder_class: Cycle::VanishedRemainder)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -28,7 +28,11 @@ module Zakuro
28
28
  # @param [Integer] western_year 西暦年
29
29
  #
30
30
  def initialize(lunar_age:, western_year:)
31
- super(lunar_age: lunar_age, western_year: western_year)
31
+ super(
32
+ lunar_age: lunar_age,
33
+ quarter: QUARTER,
34
+ western_year: western_year
35
+ )
32
36
  end
33
37
 
34
38
  #
@@ -43,13 +47,6 @@ module Zakuro
43
47
  first
44
48
  end
45
49
 
46
- #
47
- # 弦の分だけ月地点を進める
48
- #
49
- def add_quarter
50
- remainder.add!(QUARTER)
51
- end
52
-
53
50
  private
54
51
 
55
52
  #
@@ -43,7 +43,9 @@ module Zakuro
43
43
  return '' if invalid?
44
44
 
45
45
  decimal = day + minute / base_day.to_f
46
- super(form, decimal.round(digit))
46
+
47
+ # NOTE: 親クラスを迂回する
48
+ Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
47
49
  end
48
50
  end
49
51
 
@@ -84,7 +86,9 @@ module Zakuro
84
86
  # 具体的には、468年の中気は '55.7813' だが '55.7812' になる
85
87
  # これは '55.7812500' を4桁にした際に、境界値の少数点以下5桁目の '5' が切り捨てを受けたためである
86
88
  # format による四捨五入は避け、roundによる四捨五入を採用する
87
- super(form, decimal.round(digit))
89
+
90
+ # NOTE: 親クラスを迂回する
91
+ Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
88
92
  end
89
93
  end
90
94
  end
@@ -47,7 +47,7 @@ module Zakuro
47
47
  #
48
48
  # 次の弦に進める
49
49
  #
50
- # @return [Remainder] 定朔
50
+ # @return [Remainder] 経朔
51
51
  #
52
52
  def next_phase
53
53
  adjusted = remainder.clone
@@ -59,9 +59,9 @@ module Zakuro
59
59
 
60
60
  #
61
61
  # 次の月に進める
62
- # @note 進めた後の月の定朔ではなく、当月のものを返却する
62
+ # @note 進めた後の月の経朔ではなく、当月のものを返却する
63
63
  #
64
- # @return [Remainder] 当月初の定朔
64
+ # @return [Remainder] 当月初の経朔
65
65
  #
66
66
  def next_month
67
67
  result = nil
@@ -73,6 +73,17 @@ module Zakuro
73
73
  result
74
74
  end
75
75
 
76
+ #
77
+ # 経朔を返す
78
+ #
79
+ # 元嘉暦には経朔しかないが他の暦と揃える
80
+ #
81
+ # @return [Remainder] 経朔
82
+ #
83
+ def average_remainder
84
+ @remainder
85
+ end
86
+
76
87
  private
77
88
 
78
89
  #
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../../calculation/option/vanished_date/abstract_parameter'
4
+
5
+ require_relative '../../const/number'
6
+ require_relative '../../const/remainder'
7
+ require_relative '../../cycle/remainder'
8
+
9
+ # :nodoc:
10
+ module Zakuro
11
+ # :nodoc:
12
+ module Genka
13
+ # :nodoc:
14
+ module Option
15
+ # :nodoc:
16
+ module VanishedDate
17
+ #
18
+ # Parameter 引数
19
+ #
20
+ class Parameter < Calculation::Option::VanishedDate::AbstractParameter
21
+ #
22
+ # 初期化
23
+ #
24
+ def initialize
25
+ super(valid: false)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -42,11 +42,7 @@ module Zakuro
42
42
  # * 0.75 * 12(1分=12秒) = 9
43
43
  #
44
44
  # @return [Cycle::LunarRemainder] 弦(1分=12秒)
45
- # TODO: 9秒だと通らない。 0.00378 0.0208 の範囲内で通る
46
- # QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9)
47
- # QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.00378)
48
- # QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.0208)
49
- QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.00378)
45
+ QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9)
50
46
  end
51
47
  end
52
48
  end
@@ -29,19 +29,6 @@ module Zakuro
29
29
  super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
30
30
  day: day, minute: minute, second: second, total: total)
31
31
  end
32
-
33
- #
34
- # 特定の文字フォーマットにして出力する
35
- #
36
- # @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
37
- #
38
- # @return [String] フォーマットした結果
39
- #
40
- def format(form: '%d-%d')
41
- return '' if invalid?
42
-
43
- super(form, @day, @minute, @second)
44
- end
45
32
  end
46
33
 
47
34
  #
@@ -63,19 +50,6 @@ module Zakuro
63
50
  super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
64
51
  day: day, minute: minute, second: second, total: total)
65
52
  end
66
-
67
- #
68
- # 特定の文字フォーマットにして出力する
69
- #
70
- # @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
71
- #
72
- # @return [String] フォーマットした結果
73
- #
74
- def format(form: '%d-%d')
75
- return '' if invalid?
76
-
77
- super(form, @day, @minute, @second)
78
- end
79
53
  end
80
54
  end
81
55
  end
@@ -64,7 +64,7 @@ module Zakuro
64
64
  # NOTE: 儀鳳暦では進朔しない
65
65
  # adjusted.up_on_new_moon!
66
66
 
67
- debug("result: #{adjusted.format}")
67
+ debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
68
68
 
69
69
  adjusted
70
70
  end
@@ -94,9 +94,7 @@ module Zakuro
94
94
 
95
95
  remainder = lunar_location.adjusted_remainder
96
96
 
97
- # debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
98
- # debug("[lunar]remainder.day: #{remainder.day}")
99
- # debug("[lunar]remainder.minute: #{remainder.minute}")
97
+ debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
100
98
 
101
99
  Lunar::Value.get(remainder: remainder)
102
100
  end