class Range
def overlaps?(other)
(1..5).overlaps?(4..6) # => true
Compare two ranges and see if they overlap each other
def overlaps?(other) other.begin == self.begin || cover?(other.begin) || other.cover?(self.begin) end
def overlaps?(other) other.begin == self.begin || cover?(other.begin) || other.cover?(self.begin) end