class Toys::Templates::Yardoc

A template that generates yardoc tools.

Constants

DEFAULT_FILES

Default file globs @return [Array<String>]

DEFAULT_GEM_VERSION_REQUIREMENTS

Default version requirements for the yard gem. @return [String]

DEFAULT_OUTPUT_DIR

Default output directory @return [String]

DEFAULT_TOOL_NAME

Default tool name @return [String]

Attributes

bundler[W]

Set the bundler state and options for this tool.

Pass `false` to disable bundler. Pass `true` or a hash of options to enable bundler. See the documentation for the [bundler mixin](dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler) for information on the options that can be passed.

@param value [Boolean,Hash] @return [Boolean,Hash]

context_directory[RW]

Custom context directory for this tool.

@param value [String] @return [String]

fail_on_undocumented_objects[RW]

Whether the tool should return a nonzero error code if any objects remain undocumented.

@param value [Boolean] @return [Boolean]

fail_on_warning[RW]

Whether the tool should return a nonzero error code if any warnings happen.

@param value [Boolean] @return [Boolean]

files[W]

An array of globs indicating which files to document.

@param value [Array<String>] @return [Array<String>]

format[RW]

Output format for the template. If set to `nil`, YARD will choose a default, likely “html”.

@param value [String,nil] @return [String,nil]

gem_version[W]

Version requirements for the rdoc gem. If set to `nil`, uses the bundled version if bundler is enabled, or defaults to {DEFAULT_GEM_VERSION_REQUIREMENTS} if bundler is not enabled.

@param value [String,Array<String>,nil] @return [String,Array<String>,nil]

generate_output[RW]

Whether to generate output. Setting to false causes yardoc to emit warnings/errors but not generate html.

@param value [Boolean] @return [Boolean]

generate_output_flag[RW]

Whether to create a flag `–[no-]output` that can control whether output is generated.

@param value [Boolean] @return [Boolean]

hide_private_tag[RW]

Whether to hide methods with the `@private` tag.

@param value [Boolean] @return [Boolean]

markup[RW]

Markup style used in documentation. If set to `nil`, YARD will choose a default, likely “rdoc”.

@param value [String,nil] @return [String,nil]

name[W]

Name of the tool to create.

@param value [String] @return [String]

options[W]

Additional options to pass to YARD

@param value [Array<String>] @return [Array<String>]

output_dir[W]

Name of directory to receive html output files. If set to `nil`, defaults to {DEFAULT_OUTPUT_DIR}.

@param value [String,nil] @return [String,nil]

readme[RW]

Name of the readme file used as the title page. If set to `nil`, YARD will choose a default.

@param value [String,nil] @return [String,nil]

show_private[RW]

Whether to document private methods.

@param value [Boolean] @return [Boolean]

show_protected[RW]

Whether to document protected methods.

@param value [Boolean] @return [Boolean]

show_public[RW]

Whether to document public methods.

@param value [Boolean] @return [Boolean]

stats_options[W]

Additional stats options to pass to YARD

@param value [Array<String>] @return [Array<String>]

template[RW]

Template to use. If set to `nil`, YARD will choose a default.

@param value [String,nil] @return [String,nil]

template_path[RW]

Directory path to look for templates in. If set to `nil`, no additional template lookup paths will be used.

@param value [String,nil] @return [String,nil]

Public Class Methods

new(name: nil, gem_version: nil, files: nil, generate_output: true, generate_output_flag: false, output_dir: nil, fail_on_warning: false, fail_on_undocumented_objects: false, show_public: true, show_protected: false, show_private: false, hide_private_tag: false, readme: nil, markup: nil, template: nil, template_path: nil, format: nil, options: [], stats_options: [], bundler: false, context_directory: nil) click to toggle source

Create the template settings for the Yardoc template.

@param name [String] Name of the tool to create. Defaults to

{DEFAULT_TOOL_NAME}.

@param gem_version [String,Array<String>] Version requirements for

the yard gem. Defaults to {DEFAULT_GEM_VERSION_REQUIREMENTS}.

@param files [Array<String>] An array of globs indicating the files

to document. Defaults to {DEFAULT_FILES}.

@param generate_output [Boolean] Whether to generate output. Setting to

false causes yardoc to emit warnings/errors but not generate html.
Defaults to true.

@param generate_output_flag [Boolean] Whether to create a flag

`--[no-]output` that can control whether output is generated.
Defaults to false.

@param output_dir [String,nil] Output directory. Defaults to

{DEFAULT_OUTPUT_DIR}.

@param fail_on_warning [Boolean] Whether the tool should return a

nonzero error code if any warnings happen. Defaults to false.

@param fail_on_undocumented_objects [Boolean] Whether the tool should

return a nonzero error code if any objects remain undocumented.
Defaults to false.

@param show_public [Boolean] Show public methods. Defaults to true. @param show_protected [Boolean] Show protected methods. Defaults to

false.

@param show_private [Boolean] Show private methods. Defaults to false. @param hide_private_tag [Boolean] Hide methods with the `@private` tag.

Defaults to false.

@param readme [String,nil] Name of the readme file used as the title

page. If not provided, YARD will choose a default.

@param markup [String,nil] Markup style used in documentation. If not

provided, YARD will choose a default, likely "rdoc".

@param template [String,nil] Template to use. If not provided, YARD

will choose a default.

@param template_path [String,nil] The optional template path to look

for templates in.

@param format [String,nil] The output format for the template. If not

provided, YARD will choose a default, likely "html".

@param options [Array<String>] Additional options passed to YARD @param stats_options [Array<String>] Additional stats options passed to

YARD

@param bundler [Boolean,Hash] If `false` (the default), bundler is not

enabled for this tool. If `true` or a Hash of options, bundler is
enabled. See the documentation for the
[bundler mixin](https://dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler)
for information on available options.

@param context_directory [String] A custom context directory to use

when executing this tool.
# File lib/toys/templates/yardoc.rb, line 84
def initialize(name: nil,
               gem_version: nil,
               files: nil,
               generate_output: true,
               generate_output_flag: false,
               output_dir: nil,
               fail_on_warning: false,
               fail_on_undocumented_objects: false,
               show_public: true,
               show_protected: false,
               show_private: false,
               hide_private_tag: false,
               readme: nil,
               markup: nil,
               template: nil,
               template_path: nil,
               format: nil,
               options: [],
               stats_options: [],
               bundler: false,
               context_directory: nil)
  @name = name
  @gem_version = gem_version
  @files = files
  @generate_output = generate_output
  @generate_output_flag = generate_output_flag
  @output_dir = output_dir
  @fail_on_warning = fail_on_warning
  @fail_on_undocumented_objects = fail_on_undocumented_objects
  @show_public = show_public
  @show_protected = show_protected
  @show_private = show_private
  @hide_private_tag = hide_private_tag
  @readme = readme
  @markup = markup
  @template = template
  @template_path = template_path
  @format = format
  @options = options
  @stats_options = stats_options
  @bundler = bundler
  @context_directory = context_directory
end

Public Instance Methods

bundler_settings() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 390
def bundler_settings
  if @bundler && !@bundler.is_a?(::Hash)
    {}
  else
    @bundler
  end
end
files() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 370
def files
  @files ? Array(@files) : DEFAULT_FILES
end
gem_version() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 364
def gem_version
  return Array(@gem_version) if @gem_version
  @bundler ? [] : DEFAULT_GEM_VERSION_REQUIREMENTS
end
name() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 359
def name
  @name || DEFAULT_TOOL_NAME
end
options() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 380
def options
  Array(@options)
end
output_dir() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 375
def output_dir
  @output_dir || DEFAULT_OUTPUT_DIR
end
stats_options() click to toggle source

@private

# File lib/toys/templates/yardoc.rb, line 385
def stats_options
  Array(@stats_options)
end
use_bundler(**opts) click to toggle source

Activate bundler for this tool.

See the documentation for the [bundler mixin](dazuma.github.io/toys/gems/toys-core/latest/Toys/StandardMixins/Bundler) for information on the options that can be passed.

@param opts [keywords] Options for bundler @return [self]

# File lib/toys/templates/yardoc.rb, line 324
def use_bundler(**opts)
  @bundler = opts
  self
end