class Toys::Templates::Rdoc

A template that generates rdoc tools.

Constants

DEFAULT_FILES

Default file globs @return [Array<String>]

DEFAULT_GEM_VERSION_REQUIREMENTS

Default version requirements for the rdoc gem. @return [Array<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]

files[W]

An array of globs indicating which files to document.

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

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]

generator[RW]

Name of the format generator. If set to `nil`, RDoc will use its default generator.

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

main[RW]

Name of the file to use as the main top level document, or `nil` for no top level document.

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

markup[RW]

Markup format. Allowed values include “rdoc”, “rd”, and “tomdoc”. If set to `nil`, RDoc will use its default markup, which is “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 RDoc

@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]

template[RW]

Name of the template to use. If set to `nil`, RDoc will choose a default template.

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

title[RW]

Title of RDoc documentation pages. If set to `nil`, RDoc will use a default title.

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

Public Class Methods

new(name: nil, gem_version: nil, files: nil, output_dir: nil, markup: nil, title: nil, main: nil, template: nil, generator: nil, options: [], bundler: false, context_directory: nil) click to toggle source

Create the template settings for the Rdoc 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 rdoc 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 output_dir [String] Name of directory to receive html output

files. Defaults to {DEFAULT_OUTPUT_DIR}.

@param markup [String] Markup format. Allowed values include “rdoc”,

"rd", and "tomdoc". If not specified, RDoc will use its default
markup, which is "rdoc".

@param title [String] Title of RDoc documentation. If not specified,

RDoc will use a default title.

@param main [String] Name of the file to use as the main top level

document. Default is none.

@param template [String] Name of the template to use. If not specified,

RDoc will use its default template.

@param generator [String] Name of the format generator. If not

specified, RDoc will use its default generator.

@param options [Array<String>] Additional options to pass to RDoc. @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/rdoc.rb, line 66
def initialize(name: nil,
               gem_version: nil,
               files: nil,
               output_dir: nil,
               markup: nil,
               title: nil,
               main: nil,
               template: nil,
               generator: nil,
               options: [],
               bundler: false,
               context_directory: nil)
  @name = name
  @gem_version = gem_version
  @files = files
  @output_dir = output_dir
  @markup = markup
  @title = title
  @main = main
  @template = template
  @generator = generator
  @options = options
  @bundler = bundler
  @context_directory = context_directory
end

Public Instance Methods

bundler_settings() click to toggle source

@private

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

@private

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

@private

# File lib/toys/templates/rdoc.rb, line 236
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/rdoc.rb, line 231
def name
  @name || DEFAULT_TOOL_NAME
end
options() click to toggle source

@private

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

@private

# File lib/toys/templates/rdoc.rb, line 247
def output_dir
  @output_dir || DEFAULT_OUTPUT_DIR
end
use_bundler(**opts) click to toggle source

Use 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/rdoc.rb, line 212
def use_bundler(**opts)
  @bundler = opts
  self
end