Class: Zakuro::Calculation::Gengou::Reserve::NamedList

Inherits:
AbstractList
  • Object
show all
Defined in:
lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb

Overview

NamedList

予約元号一覧(元号名)

Constant Summary collapse

INVALID_NAME =

Returns 不正元号名.

Returns:

  • (String)

    不正元号名

Japan::Calendar::EMPTY

Constants inherited from AbstractList

AbstractList::INVALID_YEAR, AbstractList::MAX_MONTH_DAYS

Instance Attribute Summary

Attributes inherited from AbstractList

#index, #last_date, #list, #operated, #restored, #start_date

Instance Method Summary collapse

Methods inherited from AbstractList

#change_start_date?, #collect, #get, #invalid?, #japan_start_date, #native_start_date, #western_last_date, #western_last_year, #western_start_date, #western_start_year

Constructor Details

#initialize(first: true, start_name: INVALID_NAME, last_name: INVALID_NAME, operated: false, restored: false) ⇒ NamedList

初期化

Parameters:

  • first (True, False) (defaults to: true)

    true:1行目元号, false:2行目元号

  • start_name (String) (defaults to: INVALID_NAME)

    開始元号名

  • last_name (String) (defaults to: INVALID_NAME)

    終了元号名

  • operated (True, False) (defaults to: false)

    運用値設定

  • restored (True, False) (defaults to: false)

    運用値から計算値に戻すか



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb', line 30

def initialize(first: true, start_name: INVALID_NAME, last_name: INVALID_NAME,
               operated: false, restored: false)
  @index = parse_index(first: first)
  @start_date = Western::Calendar.new
  @last_date = Western::Calendar.new
  @operated = operated
  @restored = restored

  locate(start_name: start_name, last_name: last_name)
  super(
    index: index, start_date: start_date, last_date: last_date, operated: operated,
    restored: restored
  )
end