Method: TimeMath::Units::Base#decrease

Defined in:
lib/time_math/units/base.rb

#decrease(tm, amount = 1) ⇒ Time, ...

Decreases tm by given amount of unit.

Parameters:

  • tm (Time, Date, DateTime)

    time value to decrease;

  • amount (Integer) (defaults to: 1)

    how many units forward to go. For units less than week supports float/rational values.

Returns:

  • (Time, Date, DateTime)

    decrease time value; class and timezone offset of origin would be preserved.



153
154
155
156
157
# File 'lib/time_math/units/base.rb', line 153

def decrease(tm, amount = 1)
  return advance(tm, -amount) if amount < 0

  _decrease(tm, amount)
end