Class: Range
- Inherits:
-
Object
- Object
- Range
- Defined in:
- lib/axiom/core_ext/range.rb
Overview
Extend Range with methods to normalize and find overlapping ranges
Instance Method Summary collapse
-
#overlaps?(other) ⇒ Boolean
Compare the range with another range to see if they overlap.
-
#to_inclusive ⇒ Range
Returns an inclusive Range.
Instance Method Details
#overlaps?(other) ⇒ Boolean
Compare the range with another range to see if they overlap
36 37 38 |
# File 'lib/axiom/core_ext/range.rb', line 36 def overlaps?(other) cover?(other.first) || other.cover?(first) end |
#to_inclusive ⇒ Range
Returns an inclusive Range
15 16 17 18 19 20 21 |
# 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 |