Class: Zakuro::Japan::Gengou::Resource::Parser::SwitchDateParser

Inherits:
Object
  • Object
show all
Defined in:
lib/zakuro/era/japan/gengou/resource/parser.rb

Overview

SwitchDateParser 切替日(運用/計算)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash:, operated: false) ⇒ SwitchDateParser

初期化

Parameters:

  • hash (Hash<String, Strin>)

    切替日(運用/計算)

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

    運用値設定



195
196
197
198
199
# File 'lib/zakuro/era/japan/gengou/resource/parser.rb', line 195

def initialize(hash:, operated: false)
  @calculation = hash['calculation']
  @operation = hash['operation']
  @operated = operated
end

Instance Attribute Details

#calculationHash<String, Strin> (readonly)

Returns 計算値.

Returns:

  • (Hash<String, Strin>)

    計算値



183
184
185
# File 'lib/zakuro/era/japan/gengou/resource/parser.rb', line 183

def calculation
  @calculation
end

#operatedTrue, False (readonly)

Returns 運用値.

Returns:

  • (True, False)

    運用値



187
188
189
# File 'lib/zakuro/era/japan/gengou/resource/parser.rb', line 187

def operated
  @operated
end

#operationHash<String, Strin> (readonly)

Returns 運用値.

Returns:

  • (Hash<String, Strin>)

    運用値



185
186
187
# File 'lib/zakuro/era/japan/gengou/resource/parser.rb', line 185

def operation
  @operation
end

Instance Method Details

#createType::Base::SwitchDate

切替日(運用/計算)情報を生成する

Returns:



206
207
208
209
210
211
212
213
214
# File 'lib/zakuro/era/japan/gengou/resource/parser.rb', line 206

def create
  calculation_date = Both::DateParser.new(hash: calculation).create
  operation_date = Both::DateParser.new(hash: operation).create

  Type::Base::SwitchDate.new(
    calculation: calculation_date, operation: operation_date,
    operated: operated
  )
end