aboutsummaryrefslogtreecommitdiffstats
path: root/lib/time_duration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/time_duration.rb')
-rw-r--r--lib/time_duration.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/time_duration.rb b/lib/time_duration.rb
index 4d12654c2..f64c81bdd 100644
--- a/lib/time_duration.rb
+++ b/lib/time_duration.rb
@@ -1,4 +1,13 @@
module TimeDuration
+ # `earlier` and `later` are times. Get the duration between those times and
+ # check whether it's longer than the given `duration`.
+ #
+ # Example:
+ # TimeDuration.exceeds_gap?(
+ # 4.hours,
+ # Time.now,
+ # Time.now + 2.hours
+ # )
def self.exceeds_gap?(duration, earlier, later)
duration < (later - earlier)
end