Method: YARD::CodeObjects::MacroObject.apply
- Defined in:
- lib/yard/code_objects/macro_object.rb
.apply(docstring, call_params = [], full_source = '', block_source = '', _method_object = nil) ⇒ String
Applies a macro on a docstring by creating any macro data inside of the docstring first. Equivalent to calling find_or_create and apply_macro on the new macro object.
119 120 121 122 123 124 125 126 127 |
# File 'lib/yard/code_objects/macro_object.rb', line 119 def apply(docstring, call_params = [], full_source = '', block_source = '', _method_object = nil) # rubocop:disable Lint/UnusedMethodArgument docstring = docstring.all if Docstring === docstring parser = Docstring.parser handler = OpenStruct.new handler.call_params = call_params[1..-1] handler.caller_method = call_params.first handler.statement = OpenStruct.new(:source => full_source) parser.parse(docstring, nil, handler).to_docstring.to_raw end |