Guest User

Untitled

a guest
Jul 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Fixnum
  2. def seconds
  3. self
  4. end
  5.  
  6. def minutes
  7. self * 60
  8. end
  9.  
  10. def hours
  11. minutes * 60
  12. end
  13.  
  14. def days
  15. hours * 24
  16. end
  17.  
  18. def ago
  19. Time.now - self
  20. end
  21.  
  22. def from_now
  23. Time.now + self
  24. end
  25. end
  26.  
  27. puts Time.now # => Thu Dec 23 09:41:04 +0100 2010
  28. puts 3.days.from_now # => Sun Dec 26 09:41:06 +0100 2010
Add Comment
Please, Sign In to add comment