Class: Toys::Templates::Rdoc

Inherits:
Object
  • Object
show all
Includes:
Template
Defined in:
lib/toys/templates/rdoc.rb

Overview

A template that generates rdoc tools.

Constant Summary collapse

DEFAULT_GEM_VERSION_REQUIREMENTS =

Default version requirements for the rdoc gem.

Returns:

  • (Array<String>)
["~> 6.1.0"].freeze
DEFAULT_TOOL_NAME =

Default tool name

Returns:

  • (String)
"rdoc"
DEFAULT_OUTPUT_DIR =

Default output directory

Returns:

  • (String)
"html"
DEFAULT_FILES =

Default file globs

Returns:

  • (Array<String>)
["lib/**/*.rb"].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, gem_version: nil, files: nil, output_dir: nil, markup: nil, title: nil, main: nil, template: nil, generator: nil, options: [], bundler: false) ⇒ Rdoc

Create the template settings for the Rdoc template.

Parameters:

  • name (String) (defaults to: nil)

    Name of the tool to create. Defaults to DEFAULT_TOOL_NAME.

  • gem_version (String, Array<String>) (defaults to: nil)

    Version requirements for the rdoc gem. Defaults to DEFAULT_GEM_VERSION_REQUIREMENTS.

  • files (Array<String>) (defaults to: nil)

    An array of globs indicating the files to document. Defaults to DEFAULT_FILES.

  • output_dir (String) (defaults to: nil)

    Name of directory to receive html output files. Defaults to DEFAULT_OUTPUT_DIR.

  • markup (String) (defaults to: nil)

    Markup format. Allowed values include "rdoc", "rd", and "tomdoc". If not specified, RDoc will use its default markup, which is "rdoc".

  • title (String) (defaults to: nil)

    Title of RDoc documentation. If not specified, RDoc will use a default title.

  • main (String) (defaults to: nil)

    Name of the file to use as the main top level document. Default is none.

  • template (String) (defaults to: nil)

    Name of the template to use. If not specified, RDoc will use its default template.

  • generator (String) (defaults to: nil)

    Name of the format generator. If not specified, RDoc will use its default generator.

  • options (Array<String>) (defaults to: [])

    Additional options to pass to RDoc.

  • bundler (Boolean, Hash) (defaults to: false)

    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 for information on available options.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/toys/templates/rdoc.rb', line 64

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)
  @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
end

Instance Attribute Details

#bundler=(value) ⇒ Boolean, Hash (writeonly)

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 for information on the options that can be passed.

Parameters:

  • value (Boolean, Hash)

Returns:

  • (Boolean, Hash)


188
189
190
# File 'lib/toys/templates/rdoc.rb', line 188

def bundler=(value)
  @bundler = value
end

#files=(value) ⇒ Array<String>

An array of globs indicating which files to document.

Parameters:

  • value (Array<String>)

Returns:

  • (Array<String>)


113
114
115
# File 'lib/toys/templates/rdoc.rb', line 113

def files=(value)
  @files = value
end

#gem_version=(value) ⇒ String, ...

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.

Parameters:

  • value (String, Array<String>, nil)

Returns:

  • (String, Array<String>, nil)


105
106
107
# File 'lib/toys/templates/rdoc.rb', line 105

def gem_version=(value)
  @gem_version = value
end

#generator=(value) ⇒ String?

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

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


167
168
169
# File 'lib/toys/templates/rdoc.rb', line 167

def generator=(value)
  @generator = value
end

#main=(value) ⇒ String?

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

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


149
150
151
# File 'lib/toys/templates/rdoc.rb', line 149

def main=(value)
  @main = value
end

#markup=(value) ⇒ String?

Markup format. Allowed values include "rdoc", "rd", and "tomdoc". If set to nil, RDoc will use its default markup, which is "rdoc".

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


131
132
133
# File 'lib/toys/templates/rdoc.rb', line 131

def markup=(value)
  @markup = value
end

#name=(value) ⇒ String

Name of the tool to create.

Parameters:

  • value (String)

Returns:

  • (String)


94
95
96
# File 'lib/toys/templates/rdoc.rb', line 94

def name=(value)
  @name = value
end

#options=(value) ⇒ Array<String>

Additional options to pass to RDoc

Parameters:

  • value (Array<String>)

Returns:

  • (Array<String>)


175
176
177
# File 'lib/toys/templates/rdoc.rb', line 175

def options=(value)
  @options = value
end

#output_dir=(value) ⇒ String?

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

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


122
123
124
# File 'lib/toys/templates/rdoc.rb', line 122

def output_dir=(value)
  @output_dir = value
end

#template=(value) ⇒ String?

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

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


158
159
160
# File 'lib/toys/templates/rdoc.rb', line 158

def template=(value)
  @template = value
end

#title=(value) ⇒ String?

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

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


140
141
142
# File 'lib/toys/templates/rdoc.rb', line 140

def title=(value)
  @title = value
end

Instance Method Details

#use_bundler(**opts) ⇒ self

Use bundler for this tool.

See the documentation for the bundler mixin for information on the options that can be passed.

Parameters:

  • opts (keywords)

    Options for bundler

Returns:

  • (self)


200
201
202
203
# File 'lib/toys/templates/rdoc.rb', line 200

def use_bundler(**opts)
  @bundler = opts
  self
end