lib/garcon/core_ext/time.rb
# Returns a new Time representing the time a number of time-units ago.
# This is just like #shift, but reverses the direction.
#
# @example
#   t = Time.utc(2010,10,10,0,0,0)
#   t.less(4, :days)             # =>  Time.utc(2010,10,6,0,0,0)
#
Returns a new Time representing the time a number of time-units ago.
This is just like #shift, but reverses the direction.
Returns a new Time representing the time a number of time - units ago . This is just like #shift but reverses the direction .
def less(*time_units)
    time_hash  = Hash===time_units.last ? time_units.pop : {}
    time_units = time_units.flatten
    time_units << :seconds if time_units.size % 2 == 1
    time_hash.each{ |units, number| time_units << number; time_units << units }
    neg_times = []
    time_units.each_slice(2){ |number, units| neg_times << -number; neg_times << units }
    shift(*neg_times)
  end
def less ( * time_units ) time_hash = Hash === time_units . last ? time_units . pop : { } time_units = time_units . flatten time_units << :seconds if time_units . size % 2 == 1 time_hash . each { | units , number | time_units << number ; time_units << units } neg_times = [ ] time_units . each_slice ( 2 ) { | number , units | neg_times << - number ; neg_times << units } shift ( * neg_times ) end
Returns a new Time representing the time a number of time-units ago.
Returns a new Time representing the time a number of time - units ago .
time_units
<not_specific>
example
None