Module: RichUnits::Times::Numeric

Included in:
Numeric
Defined in:
lib/richunits/times.rb

Overview

Numeric Times

Instance Method Summary collapse

Instance Method Details

#after(time = ::Time.now) ⇒ Object Also known as: since, hence, from_now, later

Calculates time after a given time. Default time is now. Reads best with argument: 10.minutes.after(time)



434
435
436
# File 'lib/richunits/times.rb', line 434

def after(time = ::Time.now)
  time + self
end

#before(time = ::Time.now) ⇒ Object Also known as: until, ago

Calculates time before a given time. Default time is now. Reads best with arguments: 10.days.before( Time.now - 1.day )



426
427
428
# File 'lib/richunits/times.rb', line 426

def before(time = ::Time.now)
  time - self
end