Class: Daru::Offsets::YearEnd
Overview
Constant Summary
collapse
- FREQ =
'YE'.freeze
Instance Method Summary
collapse
#freq_string, #initialize
Methods inherited from DateOffset
#-@, #initialize
Instance Method Details
#+(date_time) ⇒ Object
363
364
365
366
367
368
369
370
371
|
# File 'lib/daru/date_time/offsets.rb', line 363
def + date_time
if on_offset?(date_time)
DateTime.new(date_time.year + @n, 12, 31,
date_time.hour, date_time.min, date_time.sec)
else
DateTime.new(date_time.year + (@n-1), 12, 31,
date_time.hour, date_time.min, date_time.sec)
end
end
|
#-(date_time) ⇒ Object
373
374
375
|
# File 'lib/daru/date_time/offsets.rb', line 373
def - date_time
DateTime.new(date_time.year - 1, 12, 31)
end
|
#on_offset?(date_time) ⇒ Boolean
377
378
379
|
# File 'lib/daru/date_time/offsets.rb', line 377
def on_offset? date_time
date_time.month == 12 && date_time.day == 31
end
|