Class: Zakuro::Calculation::Range::AbstractFullRange
- Inherits:
-
Object
- Object
- Zakuro::Calculation::Range::AbstractFullRange
- Defined in:
- lib/zakuro/calculation/range/abstract_full_range.rb
Overview
FullRange 完全範囲
NOTE: 割り当てた元号は年初を基準にした元号年である
*
Direct Known Subclasses
Constant Summary collapse
- LOGGER =
Returns ロガー.
Output::Logger.new(location: 'full_range')
Instance Attribute Summary collapse
-
#context ⇒ Context::Context
readonly
暦コンテキスト.
-
#last_date ⇒ Western::Calendar
readonly
終了日.
-
#scroll ⇒ MultiGengouRoller
readonly
改元処理.
-
#start_date ⇒ Western::Calendar
readonly
開始日.
Instance Method Summary collapse
-
#get ⇒ Array<Base::Year>
完全範囲を取得する.
-
#initialize(context:, scroll:, start_date: Western::Calendar.new, last_date: Western::Calendar.new) ⇒ AbstractFullRange
constructor
初期化.
-
#invalid? ⇒ True, False
無効か.
Constructor Details
#initialize(context:, scroll:, start_date: Western::Calendar.new, last_date: Western::Calendar.new) ⇒ AbstractFullRange
初期化
56 57 58 59 60 61 62 63 64 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 56 def initialize(context:, scroll:, start_date: Western::Calendar.new, last_date: Western::Calendar.new) @start_date = start_date @last_date = last_date return if invalid? @context = context @scroll = scroll end |
Instance Attribute Details
#context ⇒ Context::Context (readonly)
Returns 暦コンテキスト.
37 38 39 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 37 def context @context end |
#last_date ⇒ Western::Calendar (readonly)
Returns 終了日.
41 42 43 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 41 def last_date @last_date end |
#scroll ⇒ MultiGengouRoller (readonly)
Returns 改元処理.
43 44 45 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 43 def scroll @scroll end |
#start_date ⇒ Western::Calendar (readonly)
Returns 開始日.
39 40 41 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 39 def start_date @start_date end |
Instance Method Details
#get ⇒ Array<Base::Year>
完全範囲を取得する
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 81 def get return [] if invalid? years = version_ranges years.each(&:commit) Transfer::GengouScroller.set(scroll: scroll, years: years) (years: years) years end |
#invalid? ⇒ True, False
無効か
72 73 74 |
# File 'lib/zakuro/calculation/range/abstract_full_range.rb', line 72 def invalid? start_date.invalid? end |