Class: Range
Instance Method Summary collapse
-
#move(n) ⇒ Object
(1..2).move(2) == (3..4).
- #overlap?(other) ⇒ Boolean
Instance Method Details
#move(n) ⇒ Object
(1..2).move(2) == (3..4)
8 9 10 11 12 13 14 |
# File 'lib/ruco/core_ext/range.rb', line 8 def move(n) if exclude_end? (first + n)...(last + n) else (first + n)..(last + n) end end |
#overlap?(other) ⇒ Boolean
3 4 5 |
# File 'lib/ruco/core_ext/range.rb', line 3 def overlap?(other) (first <= other.last) and (other.first <= last) end |