class Date

def advance(options)

Experimental RBS support (using type sampling data from the type_fusion project).

def advance: (Hash options) -> Date

This signature was generated using 3 samples from 1 application.


# => Mon, 01 Nov 2004
Date.new(2004, 9, 30).advance(days: 1).advance(months: 1)

Whereas incrementing first by days then by months yields a different result:

# => Sun, 31 Oct 2004
Date.new(2004, 9, 30).advance(months: 1, days: 1)

then by days:
result around the end of a month. For example, incrementing first by months
+:months+, then by +:weeks+, then by +:days+. This order can affect the
In other words, the date is incremented first by +:years+, then by
The increments are applied in order of time units from largest to smallest.

any of these keys: :years, :months, :weeks, :days.
Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with
def advance(options)
  d = self
  d = d >> options[:years] * 12 if options[:years]
  d = d >> options[:months] if options[:months]
  d = d + options[:weeks] * 7 if options[:weeks]
  d = d + options[:days] if options[:days]
  d
end