Method: YARD::Templates::Template#sections

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

#sections(*args) ⇒ Object

Sets the sections (and subsections) to be rendered for the template

Examples:

Sets a set of erb sections

sections :a, :b, :c # searches for a.erb, b.erb, c.erb

Sets a set of method and erb sections

sections :a, :b, :c # a is a method, the rest are erb files

Sections with subsections

sections :header, [:name, :children]
# the above will call header.erb and only renders the subsections
# if they are yielded by the template (see #yieldall)

Parameters:

  • args (Array<Symbol, String, Template, Array>)

    the sections to use to render the template. For symbols and strings, the section will be executed as a method (if one exists), or rendered from the file “name.erb” where name is the section name. For templates, they will have YARD::Templates::Template::ClassMethods#run called on them. Any subsections can be yielded to using yield or #yieldall



226
227
228
229
# File 'lib/yard/templates/template.rb', line 226

def sections(*args)
  @sections = Section.new(nil, *args) unless args.empty?
  @sections
end