We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1b08a81 + 8a3aae5 commit 7dcec6fCopy full SHA for 7dcec6f
activesupport/lib/active_support/core_ext/range/overlap.rb
@@ -1,10 +1,10 @@
1
# frozen_string_literal: true
2
3
class Range
4
- # Compare two ranges and see if they overlap each other
5
- # (1..5).overlap?(4..6) # => true
6
- # (1..5).overlap?(7..9) # => false
7
unless Range.method_defined?(:overlap?) # Ruby 3.3+
+ # Compare two ranges and see if they overlap each other
+ # (1..5).overlap?(4..6) # => true
+ # (1..5).overlap?(7..9) # => false
8
def overlap?(other)
9
raise TypeError unless other.is_a? Range
10
0 commit comments