123456789_123456789_123456789_123456789_123456789_

Class: YARD::Templates::TemplateOptions

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: YARD::Options
Defined in: lib/yard/templates/template_options.rb

Overview

An Options class containing default options for base template rendering. For options specific to generation of HTML output, see ::YARD::CLI::YardocOptions.

Class Method Summary

::YARD::Options - Inherited

.default_attr

Defines an attribute named key and sets a default value for it.

Instance Attribute Summary

Instance Method Summary

::YARD::Options - Inherited

#==,
#[]

Delegates calls with ::Hash syntax to actual method with key name.

#[]=

Delegates setter calls with ::Hash syntax to the attribute setter with the key name.

#delete

Deletes an option value for key

#each

Yields over every option key and value.

#inspect

Inspects the object.

#merge

Creates a new options object and sets options hash or object value onto that object.

#method_missing

Handles setting and accessing of unregistered keys similar to an ::YARD::OpenStruct object.

#reset_defaults

Resets all values to their defaults.

#tap

only for 1.8.6.

#to_hash,
#update

Updates values from an options hash or options object on this object.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class YARD::Options

Instance Attribute Details

#__globals (readonly)

Alias for #globals.

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 34

alias __globals globals

#default_returnString (rw)

Returns:

  • (String)

    the default return type for a method with no return tags

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 20

default_attr :default_return, "Object"

#embed_mixinsArray<String> (rw)

Examples:

A list of mixin path names (including wildcards)

opts.embed_mixins #=> ['ClassMethods', '*Helper', 'YARD::*']

Returns:

  • (Array<String>)

    an array of module name wildcards to embed into class documentation as if their methods were defined directly in the class. Useful for modules like ClassMethods. If the name contains '::', the module is matched against the full mixin path, otherwise only the module name is used.

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 71

default_attr :embed_mixins, lambda { [] }

#formatSymbol (rw)

Returns:

  • (Symbol)

    the template output format

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 11

default_attr :format, :text

#globalsOpenStruct (rw) Also known as: #__globals

Returns:

  • (OpenStruct)

    an open struct containing any global state across all generated objects in a template.

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 33

default_attr :globals, lambda { OpenStruct.new }

#hide_void_returnBoolean (rw)

Returns:

  • (Boolean)

    whether void methods should show "void" in their signature

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 23

default_attr :hide_void_return, false

#highlightBoolean (rw)

Returns:

  • (Boolean)

    whether code blocks should be syntax highlighted

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 26

default_attr :highlight, true

#indexBoolean (rw)

Returns:

  • (Boolean)

    whether the page is the "index"

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 63

attr_accessor :index

#markupSymbol (rw)

Returns:

  • (Symbol)

    the markup format to use when parsing docstrings

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 17

default_attr :markup, :rdoc # default is :rdoc but falls back on :none

#markup_providerClass (rw)

Returns:

  • (Class)

    the markup provider class for the markup format

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 29

attr_accessor :markup_provider

#no_highlightBoolean (rw)

Deprecated.

use #highlight instead.

Returns:

  • (Boolean)

    whether highlighting should be ignored

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 56

attr_reader :no_highlight

#no_highlight=(value) (rw)

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 57

def no_highlight=(value) self.highlight = !value end

#objectCodeObjects::Base (rw)

Returns:

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 37

attr_accessor :object

#ownerCodeObjects::Base (rw)

Returns:

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 40

attr_accessor :owner

#page_titleString (rw)

Returns:

  • (String)

    the title of a given page

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 60

attr_accessor :page_title

#serializeBoolean (rw)

Returns:

  • (Boolean)

    whether serialization should be performed

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 46

default_attr :serialize, true

#serializerSerializers::Base (rw)

Returns:

  • (Serializers::Base)

    the serializer used to generate links and serialize output. Serialization output only occurs if #serialize is true.

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 50

attr_accessor :serializer

#templateSymbol (rw)

Returns:

  • (Symbol)

    the template name used to render output

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 14

default_attr :template, :default

#typeSymbol (rw)

Returns:

  • (Symbol)

    the template type used to generate output

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 43

attr_accessor :type

#verifierVerifier (rw)

Returns:

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 88

attr_accessor :verifier

Instance Method Details

#embed_mixins_match?(mixin) ⇒ Boolean?

Parameters:

  • mixin (CodeObjects::Base)

    accepts any code object, but returns nil unless the object is a module.

Returns:

  • (Boolean)

    whether a mixin matches the embed_mixins list

  • (nil)

    if the mixin is not a module object

[ GitHub ]

  
# File 'lib/yard/templates/template_options.rb', line 77

def embed_mixins_match?(mixin)
  return true if mixin == object # the method is not inherited
  return nil unless mixin.is_a?(CodeObjects::ModuleObject)
  embed_mixins.any? do |embed_mixin|
    re = /\A#{Regexp.quote(embed_mixin).gsub('\*', '.*')}\Z/
    matchstr = embed_mixin.include?("::") ? mixin.path : mixin.name
    re.match(matchstr.to_s)
  end
end