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.

Parameters:

  • docstring (Docstring)

    the docstring to create a macro out of

  • call_params (Array<String>) (defaults to: [])

    the method name and parameters to the method call. These arguments will fill $0-N

  • full_source (String) (defaults to: '')

    the full source line (excluding block) interpolated as $*

  • block_source (String) (defaults to: '')

    Currently unused. Will support interpolating the block data as a variable.

Returns:

  • (String)

    the expanded macro data

See Also:



120
121
122
123
# File 'lib/yard/code_objects/macro_object.rb', line 120

def apply(docstring, call_params = [], full_source = '', block_source = '', method_object = nil)
  macro = find_or_create(docstring, method_object)
  apply_macro(macro, docstring, call_params, full_source, block_source)
end