Method: YARD::CodeObjects::MacroObject.create

Defined in:
lib/yard/code_objects/macro_object.rb

.create(macro_name, data, method_object = nil) ⇒ MacroObject

Creates a new macro and fills in the relevant properties.

Parameters:

  • macro_name (String)

    the name of the macro, must be unique.

  • data (String)

    the data the macro should expand when re-used

  • method_object (CodeObjects::Base) (defaults to: nil)

    an object to attach this macro to. If supplied, #attached? will be true

Returns:



37
38
39
40
41
42
# File 'lib/yard/code_objects/macro_object.rb', line 37

def create(macro_name, data, method_object = nil)
  obj = new(:root, macro_name)
  obj.macro_data = data
  obj.method_object = method_object
  obj
end