class Range
Extend Range
with methods to normalize and find overlapping ranges
Public Instance Methods
overlaps?(other)
click to toggle source
Compare the range with another range to see if they overlap
@example
range.overlaps?(other) # => true or false
@param [Range] other
the other Range to compare with
@return [Boolean]
@api public
# File lib/axiom/core_ext/range.rb, line 36 def overlaps?(other) cover?(other.first) || other.cover?(first) end
to_inclusive()
click to toggle source
Returns an inclusive Range
@example
inclusive = range.to_inclusive
@return [Range]
@api public
# File lib/axiom/core_ext/range.rb, line 15 def to_inclusive if exclude_end? self.class.new(first, last.pred) else self end end