Class: DaruLite::Offsets::YearEnd
Overview
Constant Summary
collapse
- FREQ =
'YE'.freeze
Instance Method Summary
collapse
#freq_string, #initialize
Methods inherited from DateOffset
#-@, #initialize
Instance Method Details
369
370
371
372
373
374
375
376
377
|
# File 'lib/daru_lite/date_time/offsets.rb', line 369
def +(other)
if on_offset?(other)
DateTime.new(other.year + @n, 12, 31,
other.hour, other.min, other.sec)
else
DateTime.new(other.year + (@n - 1), 12, 31,
other.hour, other.min, other.sec)
end
end
|
379
380
381
|
# File 'lib/daru_lite/date_time/offsets.rb', line 379
def -(other)
DateTime.new(other.year - 1, 12, 31)
end
|
#on_offset?(date_time) ⇒ Boolean
383
384
385
|
# File 'lib/daru_lite/date_time/offsets.rb', line 383
def on_offset?(date_time)
date_time.month == 12 && date_time.day == 31
end
|