lib/yard/handlers/ruby/dsl_handler_methods.rb in yard-0.8.3 vs lib/yard/handlers/ruby/dsl_handler_methods.rb in yard-0.8.4
- old
+ new
@@ -12,10 +12,16 @@
def handle_comments
return if IGNORE_METHODS[caller_method]
@docstring = statement.comments || ""
@docstring = @docstring.join("\n") if @docstring.is_a?(Array)
+
+ if @docstring =~ /^@!?macro\s+\[[^\]]*attach/
+ register_docstring(nil)
+ @docstring = ""
+ end
+
if macro = find_attached_macro
@docstring += "\n" +
macro.expand([caller_method, *call_params], statement.source)
elsif !statement.comments_hash_flag && !implicit_docstring?
return register_docstring(nil)
@@ -57,10 +63,10 @@
def find_attached_macro
Registry.all(:macro).each do |macro|
next unless macro.method_object
next unless macro.method_object.name.to_s == caller_method.to_s
- (namespace.inheritance_tree + [P('Object')]).each do |obj|
+ (namespace.inheritance_tree(true) + [P('Object')]).each do |obj|
return macro if obj == macro.method_object.namespace
end
end
nil
end
\ No newline at end of file