Skip to content

Instantly share code, notes, and snippets.

@h3h h3h/time-ext.rb
Created Jun 6, 2009

Embed
What would you like to do?
class Time
def within?(time_period)
self >= Time.now && self <= Time.now + time_period
end
end
# >> (Time.now + 55.hours).within? 2.days
# false
# >> (Time.now + 45.hours).within? 2.days
# true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.