Module YARD::Templates::Helpers::BaseHelper
In: lib/yard/templates/helpers/base_helper.rb

The base helper module included in all templates.

Methods

Attributes

object  [RW] 
owner  [R]  @return [CodeObjects::Base] the object representing the current generated
  page. Might not be the current {#object} when inside sub-templates.
serializer  [RW] 

Public Instance methods

@example

  s = format_object_title ModuleObject.new(:root, :MyModuleName)
  s # => "Module: MyModuleName"

@param [CodeObjects::Base] object the object to retrieve a title for @return [String] the page title name for a given object

@example Formatted type of an exception class

  o = ClassObject.new(:root, :MyError)
  o.superclass = P('RuntimeError')
  format_object_type(o) # => "Exception"

@example Formatted type of a method

  o = MethodObject.new(:root, :to_s)
  format_object_type(o) # => "Method"

@param [CodeObjects::Base] object the object to retrieve the type for @return [String] the human-readable formatted {CodeObjects::Base#type type}

  for the object

Indents and formats source code

@param [String] value the input source code @return [String] formatted source code

Formats a list of return types for output and links each type.

@example Formatting types

  format_types(['String', 'Array']) #=> "(String, Array)"

@example Formatting types without surrounding brackets

  format_types(['String', 'Array'], false) #=> "String, Array"

@param [Array<String>] list a list of types @param [Boolean] brackets whether to surround the types in brackets @return [String] the formatted list of Ruby types

An object that keeps track of global state throughout the entire template rendering process (including any sub-templates).

@return [OpenStruct] a struct object that stores state @since 0.6.0

Escapes text. This is used a lot by the HtmlHelper and there should be some helper to "clean up" text for whatever, this is it.

Links to an extra file

@param [String] filename the filename to link to @param [String] title the title of the link @param [String] anchor optional anchor @return [String] the link to the file @since 0.5.5

Include a file as a docstring in output @since 0.7.0 @param [String] file the filename to include @return [String] the file‘s contents

Includes an object‘s docstring into output. @since 0.6.0 @param [CodeObjects::Base] object the object to include @return [String] the object‘s docstring (no tags)

Links to an object with an optional title

@param [CodeObjects::Base] object the object to link to @param [String] title the title to use for the link @return [String] the linked object

Links to a URL

@param [String] url the URL to link to @param [String] title the optional title to display the link as @param [Hash] params optional parameters for the link @return [String] the linked URL

Links objects or URLs. This method will delegate to the correct link_ method depending on the arguments passed in.

@example Linking a URL

  linkify('http://example.com')

@example Including docstring contents of an object

  linkify('include:YARD::Docstring')

@example Linking to an extra file

  linkify('file:README')

@example Linking an object by path

  linkify('YARD::Docstring')

Runs a list of objects against the {Verifier} object passed into the template and returns the subset of verified objects.

@param [Array<CodeObjects::Base>] list a list of code objects @return [Array<CodeObjects::Base>] a list of code objects that match

  the verifier. If no verifier is supplied, all objects are returned.

[Validate]