Class: ReeDate::Advance

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_date/package/ree_date/functions/advance.rb

Instance Method Summary collapse

Instance Method Details

#call(date, **opts) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/ree_lib/packages/ree_date/package/ree_date/functions/advance.rb', line 22

def call(date, **opts)
  date = date >> opts[:years] * 12 if opts[:years]
  date = date >> opts[:quarters] * 3 if opts[:quarters]
  date = date >> opts[:months] if opts[:months]
  date = date + opts[:weeks] * 7 if opts[:weeks]
  date = date + opts[:days] if opts[:days]

  date
end