Skip to content

Commit

Permalink
Do not auto-detect DSL methods as method objects if parameter name is…
Browse files Browse the repository at this point in the history
… not a valid method name

Backports and closes #464, referencing #467
  • Loading branch information
lsegal committed Jan 19, 2012
1 parent 524a62c commit 3028f8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/yard/handlers/ruby/macro_handler_methods.rb
Expand Up @@ -82,6 +82,7 @@ def method_name
name = nil if name =~ /\A\s*\Z/
name ||= call_params.first
return unless name
return unless name =~ /^#{METHODNAMEMATCH}(\s|\(|$)/
if name =~ /\A\s*([^\(; \t]+)/
name = $1
end
Expand Down
9 changes: 9 additions & 0 deletions spec/handlers/macro_handler_spec.rb
Expand Up @@ -154,4 +154,13 @@
obj.should_not be_nil
obj.signature.should == 'def beep(a, b, c)'
end

it "should not detect implicit macros with invalid method names" do
undoc_error <<-eof
##
# IMPLICIT METHOD THAT SHOULD
# NOT BE DETECTED
dsl_method '/foo/bar'
eof
end
end

0 comments on commit 3028f8d

Please sign in to comment.