Skip to content

Commit 88db33d

Browse files
authored
Merge pull request #526 from aycabta/fix-handling-variable-expansion-for-yield
Fix variable expansion in yield
2 parents 9c4cb93 + 3d7813c commit 88db33d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/rdoc/any_method.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ def param_seq
276276
# &block
277277
params.sub!(/,?\s*&\w+/, '')
278278

279-
block = @block_params.gsub(/\s*\#.*/, '')
280-
block = block.tr("\n", " ").squeeze(" ")
279+
block = @block_params.tr("\n", " ").squeeze(" ")
281280
if block[0] == ?(
282281
block.sub!(/^\(/, '').sub!(/\)/, '')
283282
end

test/test_rdoc_any_method.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ def test_markup_code_empty
8989
assert_equal '', @c2_a.markup_code
9090
end
9191

92+
def test_markup_code_with_variable_expansion
93+
m = RDoc::AnyMethod.new nil, 'method'
94+
m.parent = @c1
95+
m.block_params = '"Hello, #{world}", yield_arg'
96+
m.params = 'a'
97+
98+
assert_equal '(a) { |"Hello, #{world}", yield_arg| ... }', m.param_seq
99+
end
100+
92101
def test_marshal_dump
93102
@store.path = Dir.tmpdir
94103
top_level = @store.add_file 'file.rb'

0 commit comments

Comments
 (0)