Method: YARD::CodeObjects::MacroObject.find_or_create
- Defined in:
- lib/yard/code_objects/macro_object.rb
.find_or_create(data, method_object = nil) ⇒ MacroObject? Also known as: create_docstring
Parses a given docstring and determines if the macro is “new” or not. If the macro has $variable names or if it has a @macro tag with the [new] or [attached] flag, it is considered new.
If a new macro is found, the macro is created and registered. Otherwise the macro name is searched and returned. If a macro is not found, nil is returned.
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/yard/code_objects/macro_object.rb', line 66 def find_or_create(data, method_object = nil) docstring = Docstring === data ? data : Docstring.new(data) return unless docstring.tag(:macro) return unless name = macro_name(docstring) if new_macro?(docstring) method_object = nil unless attached_macro?(docstring, method_object) create(name, macro_data(docstring), method_object) else find(name) end end |