class Range unless defined?(Rails) def include_with_range?(value) if value.is_a?(::Range) operator = exclude_end? && !value.exclude_end? ? :< : :<= include?(value.first) && value.last.send(operator, last) else include?(value) end end end unless defined?(Rails) def overlaps?(other) cover?(other.first) || other.cover?(first) end end end