Method: When::TM::CalendarEra#upper_bound
- Defined in:
- lib/when_exe/tmreference.rb
#upper_bound(type = nil) ⇒ Object
暦年代の上限
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 |
# File 'lib/when_exe/tmreference.rb', line 1318 def upper_bound(type=nil) @upper_bound[type] ||= @epoch[-1].indeterminated_position == When::TimeValue::Max ? +Float::MAX : begin next_era = succ next_ref = next_era.reference_date if next_era.respond_to?(:reference_date) next_ref && next_ref.precision == When::YEAR && next_ref.cal_date[When::YEAR-1] == 0 ? @epoch[-1].ceil(When::YEAR).to_i - 1 : case type when true ; @epoch[-1].to_i - 1 when :reference_date ; @reference_date.to_i else ; [@reference_date.to_i, @epoch[-1].to_i - 1].max end end end |