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 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 35

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 21

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 72

default_attr :embed_mixins, lambda { [] }

#formatSymbol (rw)

Returns:

  • (Symbol)

    the template output format

[ GitHub ]

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

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 34

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 24

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 27

default_attr :highlight, true

#indexBoolean (rw)

Returns:

  • (Boolean)

    whether the page is the "index"

[ GitHub ]

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

attr_accessor :index

#markupSymbol (rw)

Returns:

  • (Symbol)

    the markup format to use when parsing docstrings

[ GitHub ]

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

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 30

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 57

attr_reader :no_highlight

#no_highlight=(value) (rw)

[ GitHub ]

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

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

#objectCodeObjects::Base (rw)

Returns:

[ GitHub ]

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

attr_accessor :object

#ownerCodeObjects::Base (rw)

Returns:

[ GitHub ]

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

attr_accessor :owner

#page_titleString (rw)

Returns:

  • (String)

    the title of a given page

[ GitHub ]

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

attr_accessor :page_title

#serializeBoolean (rw)

Returns:

  • (Boolean)

    whether serialization should be performed

[ GitHub ]

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

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 51

attr_accessor :serializer

#templateSymbol (rw)

Returns:

  • (Symbol)

    the template name used to render output

[ GitHub ]

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

default_attr :template, :default

#typeSymbol (rw)

Returns:

  • (Symbol)

    the template type used to generate output

[ GitHub ]

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

attr_accessor :type

#verifierVerifier (rw)

Returns:

[ GitHub ]

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

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 78

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