rails/rails — pull request #4985 by shigeya (2012-02-10 06:17:41+00:00)
Title: make Range#overlaps? accept Range of Time

Current Range#overlaps? use Range#include? to check the coverage of range of Time.

Use overlaps? on Time like this:

time_range_1 = Time.utc(2005, 12, 10, 15, 30)..Time.utc(2005, 12, 10, 17, 30)
time_range_2 = Time.utc(2005, 12, 10, 17, 00)..Time.utc(2005, 12, 10, 18, 00)
assert time_range_1.overlaps?(time_range_2)

cause:

TypeError: can't iterate from Time

use cover? instead of include? makes Time range happy, as noted in [ruby-trunk Bug#3623][rtb3623]

[rtb3623]: http://bugs.ruby-lang.org/issues/3623