Method: YARD::Templates::Template.extra_includes

Defined in:
lib/yard/templates/template.rb

.extra_includesArray<Module, Proc>

Extra includes are mixins that are included after a template is created. These mixins can be registered by plugins to operate on templates and override behaviour.

Note that this array can be filled with modules or proc objects. If a proc object is given, the proc will be called with the #options hash containing relevant template information like the object, format, and more. The proc should return a module or nil if there is none.

Examples:

Adding in extra mixins to include on a template

Template.extra_includes << MyHelper

Conditionally including a mixin if the format is html

Template.extra_includes << proc {|opts| MyHelper if opts.format == :html }

Returns:

  • (Array<Module, Proc>)

    a list of modules to be automatically included into any new template module



25
26
27
# File 'lib/yard/templates/template.rb', line 25

def extra_includes
  @extra_includes
end