Skip to content

Commit 4943d20

Browse files
committed
Support linking [], []=, <<, and >> methods
This should fix issue 191.
1 parent 6d674f4 commit 4943d20

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rdoc/cross_reference.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RDoc::CrossReference
1818
#
1919
# See CLASS_REGEXP_STR
2020

21-
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===)(?:\([\w.+*/=<>-]*\))?'
21+
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?'
2222

2323
##
2424
# Regular expressions matching text that should potentially have

test/test_rdoc_cross_reference.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ def refute_ref name
1919
def test_METHOD_REGEXP_STR
2020
re = /#{RDoc::CrossReference::METHOD_REGEXP_STR}/
2121

22-
re =~ '==='
23-
24-
assert_equal '===', $&
22+
%w'=== [] []= << >>'.each do |x|
23+
re =~ x
24+
assert_equal x, $&
25+
end
2526
end
2627

2728
def test_resolve_C2

0 commit comments

Comments
 (0)