Class: Date

Inherits:
Object show all
Defined in:
lib/leap_cli/core_ext/time.rb

Instance Method Summary collapse

Instance Method Details

#advance(options) ⇒ Object

activesupport/lib/active_support/core_ext/date/calculations.rb



76
77
78
79
80
81
82
83
84
# File 'lib/leap_cli/core_ext/time.rb', line 76

def advance(options)
  options = options.dup
  d = self
  d = d >> options.delete(:years) * 12 if options[:years]
  d = d >> options.delete(:months)     if options[:months]
  d = d +  options.delete(:weeks) * 7  if options[:weeks]
  d = d +  options.delete(:days)       if options[:days]
  d
end