Class: Zakuro::Japan::Version::Resource::Parser::Both::YearParser

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

Overview

YearParser 年

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash:) ⇒ YearParser

初期化



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

def initialize(hash:)
  @japan = hash['japan']
  @western = hash['western']
end

Instance Attribute Details

#japanInteger (readonly)



174
175
176
# File 'lib/zakuro/era/japan/version/resource/parser.rb', line 174

def japan
  @japan
end

#westernInteger (readonly)



176
177
178
# File 'lib/zakuro/era/japan/version/resource/parser.rb', line 176

def western
  @western
end

Instance Method Details

#createType::Base::Both::Year

年情報を生成する



193
194
195
196
197
198
199
200
# File 'lib/zakuro/era/japan/version/resource/parser.rb', line 193

def create
  japan_year = japan.to_i
  western_year = western.to_i

  Type::Base::Both::Year.new(
    japan: japan_year, western: western_year
  )
end