/usr/lib/ruby/1.8/ramaze/snippets/numeric/time.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | module Ramaze
module CoreExtensions
# Extensions for Numeric
module Numeric
def seconds
self
end
alias second seconds
# 60 seconds in a minute
def minutes
self * 60
end
alias minute minutes
# 60 minutes in an hour
def hours
self * 3600
end
alias hour hours
# 24 hours in a day
def days
self * 86400
end
alias day days
# 7 days in a week
def weeks
self * 604800
end
alias week weeks
# 30 days in a month
def months
self * 2592000
end
alias month months
# 365.25 days in a year
def years
self * 31557600
end
alias year years
# Time in the past, i.e. 3.days.ago
def ago t = Time.now
t - self
end
alias before ago
# Time in the future, i.e. 3.days.from_now
def from_now t = Time.now
t + self
end
alias since from_now
end
end
end
|