aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-05-24 12:04:02 +0200
committerRobert2017-05-29 08:49:52 +0200
commit6dcca154825e12278849c8d3d1cacdbd8410c312 (patch)
tree90cb69964e87ef3fee15fa85a2ba2062a18c563d
parent92486d006dca19ed9931c2cdab3070c5fd0bac82 (diff)
downloadchouette-core-6dcca154825e12278849c8d3d1cacdbd8410c312.tar.bz2
TimeDuration: Add a method comment above `.exceeds_gap?`
Describe what's going on here to hopefully make it easier to understand. Refs #870
-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