Class: Zakuro::Japan::Version::Resource::Parser::Both::YearParser
- Inherits:
-
Object
- Object
- Zakuro::Japan::Version::Resource::Parser::Both::YearParser
- Defined in:
- lib/zakuro/era/japan/version/resource/parser.rb
Overview
YearParser 年
Instance Attribute Summary collapse
-
#japan ⇒ Integer
readonly
和暦元号年.
-
#western ⇒ Integer
readonly
西暦年.
Instance Method Summary collapse
-
#create ⇒ Type::Base::Both::Year
年情報を生成する.
-
#initialize(hash:) ⇒ YearParser
constructor
初期化.
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
#japan ⇒ Integer (readonly)
174 175 176 |
# File 'lib/zakuro/era/japan/version/resource/parser.rb', line 174 def japan @japan end |
#western ⇒ Integer (readonly)
176 177 178 |
# File 'lib/zakuro/era/japan/version/resource/parser.rb', line 176 def western @western end |
Instance Method Details
#create ⇒ Type::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 |