Guest User

Untitled

a guest
Apr 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1.  
  2. require 'rubygems'
  3. require 'activesupport'
  4.  
  5. t = Time.now
  6.  
  7. begin
  8. candidate = t.advance(:years => 10)
  9. puts candidate < Time.now
  10. rescue ArgumentError => exception
  11. case exception.to_s
  12. when "comparison of DateTime with Time failed"
  13. puts candidate < DateTime.now
  14. end
  15. end
Add Comment
Please, Sign In to add comment