Class: Zakuro::Calculation::Option::VanishedDate::Location
- Inherits:
-
Object
- Object
- Zakuro::Calculation::Option::VanishedDate::Location
- Defined in:
- lib/zakuro/calculation/option/vanished_date/location.rb
Overview
Location 滅日位置
Constant Summary collapse
- IDEAL_MONTH =
Returns 理想上の月日数.
30
Instance Attribute Summary collapse
-
#average_remainder ⇒ Cycle::AbstractRemainder
readonly
経朔.
-
#context ⇒ Context::Context
readonly
暦コンテキスト.
-
#limit ⇒ Cycle::AbstractRemainder
readonly
「有没之気」判定.
-
#remainder_class ⇒ Class
readonly
滅余クラス.
- #valid ⇒ True, False readonly
Instance Method Summary collapse
-
#exist? ⇒ True, False
滅日が存在するか?.
-
#get ⇒ Cycle::AbstractRemainder
「滅余」を返す.
-
#initialize(context:, average_remainder:) ⇒ Location
constructor
初期化.
-
#invalid? ⇒ True, False
不正か.
Constructor Details
#initialize(context:, average_remainder:) ⇒ Location
初期化
36 37 38 39 40 41 42 43 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 36 def initialize(context:, average_remainder:) parameter = context.resolver.vanished_date_parameter.new @context = context @valid = parameter.valid @limit = parameter.limit @average_remainder = average_remainder @remainder_class = parameter.remainder_class end |
Instance Attribute Details
#average_remainder ⇒ Cycle::AbstractRemainder (readonly)
Returns 経朔.
26 27 28 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 26 def average_remainder @average_remainder end |
#context ⇒ Context::Context (readonly)
Returns 暦コンテキスト.
19 20 21 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 19 def context @context end |
#limit ⇒ Cycle::AbstractRemainder (readonly)
Returns 「有没之気」判定.
24 25 26 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 24 def limit @limit end |
#remainder_class ⇒ Class (readonly)
Returns 滅余クラス.
28 29 30 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 28 def remainder_class @remainder_class end |
#valid ⇒ True, False (readonly)
22 23 24 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 22 def valid @valid end |
Instance Method Details
#exist? ⇒ True, False
滅日が存在するか?
61 62 63 64 65 66 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 61 def exist? minute_later = average_remainder.class.new( day: 0, minute: average_remainder.minute, second: average_remainder.second ) minute_later < limit end |
#get ⇒ Cycle::AbstractRemainder
「滅余」を返す
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 73 def get # 経朔の小余 * 30 minute = remainder_class.new( day: 0, minute: IDEAL_MONTH * average_remainder.minute, second: 0 ) day = remainder_class.new(day: average_remainder.day, minute: 0, second: 0) minute.add!(day) # p "location.minute: #{minute.format}" minute end |
#invalid? ⇒ True, False
不正か
51 52 53 |
# File 'lib/zakuro/calculation/option/vanished_date/location.rb', line 51 def invalid? !@valid end |