Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Fixnum
- def seconds
- self
- end
- def minutes
- self * 60
- end
- def hours
- minutes * 60
- end
- def days
- hours * 24
- end
- def ago
- Time.now - self
- end
- def from_now
- Time.now + self
- end
- end
- puts Time.now # => Thu Dec 23 09:41:04 +0100 2010
- puts 3.days.from_now # => Sun Dec 26 09:41:06 +0100 2010
Add Comment
Please, Sign In to add comment