Skip to content

Commit 8a3aae5

Browse files
committed
Re-add Range#overlap? documentation
When `Range#overlap?` started being defined only when Ruby itself doesn't define it, the documentation wasn't wrapped in the conditional, making RDoc not link the documentation to the defined method. This commit fixes it by moving the documentation inside the conditional. [ci skip]
1 parent d7cc945 commit 8a3aae5

File tree

1 file changed

+3
-3
lines changed
  • activesupport/lib/active_support/core_ext/range

1 file changed

+3
-3
lines changed

activesupport/lib/active_support/core_ext/range/overlap.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
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
74
unless Range.method_defined?(:overlap?) # Ruby 3.3+
5+
# Compare two ranges and see if they overlap each other
6+
# (1..5).overlap?(4..6) # => true
7+
# (1..5).overlap?(7..9) # => false
88
def overlap?(other)
99
raise TypeError unless other.is_a? Range
1010

0 commit comments

Comments
 (0)