lib/yard/handlers/ruby/dsl_handler_methods.rb in yard-0.9.5 vs lib/yard/handlers/ruby/dsl_handler_methods.rb in yard-0.9.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module YARD
module Handlers
module Ruby
module DSLHandlerMethods
include CodeObjects
@@ -20,17 +21,17 @@
register_docstring(nil)
@docstring = ""
attaching = true
end
- if macro = find_attached_macro
+ macro = find_attached_macro
+ if macro
txt = macro.expand([caller_method, *call_params], statement.source)
@docstring += "\n" + txt
- if !attaching && txt.match(/^\s*@!/) # macro has a directive
- return register_docstring(nil)
- end
+ # macro may have a directive
+ return register_docstring(nil) if !attaching && txt.match(/^\s*@!/)
elsif !statement.comments_hash_flag && !implicit_docstring?
return register_docstring(nil)
end
# ignore DSL definitions if @method/@attribute directive is used
@@ -81,14 +82,14 @@
# @return [Boolean] whether caller method matches a macro or
# its alias names.
def macro_name_matches(macro)
objs = [macro.method_object]
if objs.first.type != :proxy && objs.first.respond_to?(:aliases)
- objs.push(*objs.first.aliases)
+ objs.concat(objs.first.aliases)
end
objs.any? {|obj| obj.name.to_s == caller_method.to_s }
end
end
end
end
-end
\ No newline at end of file
+end