Skip to content

Instantly share code, notes, and snippets.

@mattly
Created April 14, 2009 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mattly/95415 to your computer and use it in GitHub Desktop.
Save mattly/95415 to your computer and use it in GitHub Desktop.
class Time
# because i often times have trouble keeping these straight
# >> 1.day.ago.before? Time.now
# => true
# >> 1.day.from_now.before? Time.now
# => false
# >> 1.day.from_now.after? Time.now
# => true
# >> 1.day.ago.after? Time.now
# => false
def before? other
self < other
end
def after? other
self > other
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment