class YARD::CodeObjects::MacroObject

def expand(macro_data, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument

Parameters:
  • macro_data (String) -- the macro data to expand (taken from {#macro_data})
  • block_source (String) -- Currently unused. Will support
  • full_source (String) -- the full source line (excluding block)
  • call_params (Array) -- the method name and parameters

Returns:
  • (String) - the expanded macro data
def expand(macro_data, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument
  macro_data = macro_data.all if macro_data.is_a?(Docstring)
  macro_data.gsub(MACRO_MATCH) do
    escape = $1
    first = $2 || $5
    last = $4
    rng = $3 ? true : false
    next $&[1..-1] if escape
    if first == '*'
      last ? $& : full_source
    else
      first_i = first.to_i
      last_i = (last ? last.to_i : call_params.size)
      last_i = first_i unless rng
      params = call_params[first_i..last_i]
      params ? params.join(", ") : ''
    end
  end
end