Class: Toys::Templates::Yardoc
- Inherits:
-
Object
- Object
- Toys::Templates::Yardoc
- Includes:
- Toys::Template
- Defined in:
- lib/toys/templates/yardoc.rb
Overview
A template that generates yardoc tools.
Constant Summary collapse
- DEFAULT_GEM_VERSION_REQUIREMENTS =
Default version requirements for the yard gem.
["~> 0.9"].freeze
- DEFAULT_TOOL_NAME =
Default tool name
"yardoc"
- DEFAULT_FILES =
Default file globs
["lib/**/*.rb"].freeze
- DEFAULT_OUTPUT_DIR =
Default output directory
"doc"
Instance Attribute Summary collapse
-
#bundler ⇒ Boolean, Hash
writeonly
Set the bundler state and options for this tool.
-
#context_directory ⇒ String
writeonly
Custom context directory for this tool.
-
#fail_on_undocumented_objects ⇒ Boolean
writeonly
Whether the tool should return a nonzero error code if any objects remain undocumented.
-
#fail_on_warning ⇒ Boolean
writeonly
Whether the tool should return a nonzero error code if any warnings happen.
-
#files ⇒ Array<String>
writeonly
An array of globs indicating which files to document.
-
#format ⇒ String?
writeonly
Output format for the template.
-
#gem_version ⇒ String, ...
writeonly
Version requirements for the rdoc gem.
-
#generate_output ⇒ Boolean
writeonly
Whether to generate output.
-
#generate_output_flag ⇒ Boolean
writeonly
Whether to create a flag
--[no-]output
that can control whether output is generated. -
#hide_private_tag ⇒ Boolean
writeonly
Whether to hide methods with the
@private
tag. -
#markup ⇒ String?
writeonly
Markup style used in documentation.
-
#name ⇒ String
writeonly
Name of the tool to create.
-
#options ⇒ Array<String>
writeonly
Additional options to pass to YARD.
-
#output_dir ⇒ String?
writeonly
Name of directory to receive html output files.
-
#readme ⇒ String?
writeonly
Name of the readme file used as the title page.
-
#show_private ⇒ Boolean
writeonly
Whether to document private methods.
-
#show_protected ⇒ Boolean
writeonly
Whether to document protected methods.
-
#show_public ⇒ Boolean
writeonly
Whether to document public methods.
-
#stats_options ⇒ Array<String>
writeonly
Additional stats options to pass to YARD.
-
#template ⇒ String?
writeonly
Template to use.
-
#template_path ⇒ String?
writeonly
Directory path to look for templates in.
Instance Method Summary collapse
-
#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) ⇒ Yardoc
constructor
Create the template settings for the Yardoc template.
-
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
Methods included from Toys::Template
Constructor Details
#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) ⇒ Yardoc
Create the template settings for the Yardoc template.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# 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 = @stats_options = @bundler = bundler @context_directory = context_directory 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.
312 313 314 |
# File 'lib/toys/templates/yardoc.rb', line 312 def bundler=(value) @bundler = value end |
#context_directory=(value) ⇒ String
Custom context directory for this tool.
299 300 301 |
# File 'lib/toys/templates/yardoc.rb', line 299 def context_directory=(value) @context_directory = value end |
#fail_on_undocumented_objects=(value) ⇒ Boolean
Whether the tool should return a nonzero error code if any objects remain undocumented.
198 199 200 |
# File 'lib/toys/templates/yardoc.rb', line 198 def fail_on_undocumented_objects=(value) @fail_on_undocumented_objects = value end |
#fail_on_warning=(value) ⇒ Boolean
Whether the tool should return a nonzero error code if any warnings happen.
189 190 191 |
# File 'lib/toys/templates/yardoc.rb', line 189 def fail_on_warning=(value) @fail_on_warning = value end |
#files=(value) ⇒ Array<String>
An array of globs indicating which files to document.
153 154 155 |
# File 'lib/toys/templates/yardoc.rb', line 153 def files=(value) @files = value end |
#format=(value) ⇒ String?
Output format for the template.
If set to nil
, YARD will choose a default, likely "html".
275 276 277 |
# File 'lib/toys/templates/yardoc.rb', line 275 def format=(value) @format = 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.
145 146 147 |
# File 'lib/toys/templates/yardoc.rb', line 145 def gem_version=(value) @gem_version = value end |
#generate_output=(value) ⇒ Boolean
Whether to generate output. Setting to false causes yardoc to emit warnings/errors but not generate html.
162 163 164 |
# File 'lib/toys/templates/yardoc.rb', line 162 def generate_output=(value) @generate_output = value end |
#generate_output_flag=(value) ⇒ Boolean
Whether to create a flag --[no-]output
that can control whether
output is generated.
171 172 173 |
# File 'lib/toys/templates/yardoc.rb', line 171 def generate_output_flag=(value) @generate_output_flag = value end |
#hide_private_tag=(value) ⇒ Boolean
Whether to hide methods with the @private
tag.
230 231 232 |
# File 'lib/toys/templates/yardoc.rb', line 230 def hide_private_tag=(value) @hide_private_tag = value end |
#markup=(value) ⇒ String?
Markup style used in documentation.
If set to nil
, YARD will choose a default, likely "rdoc".
248 249 250 |
# File 'lib/toys/templates/yardoc.rb', line 248 def markup=(value) @markup = value end |
#name=(value) ⇒ String
Name of the tool to create.
134 135 136 |
# File 'lib/toys/templates/yardoc.rb', line 134 def name=(value) @name = value end |
#options=(value) ⇒ Array<String>
Additional options to pass to YARD
283 284 285 |
# File 'lib/toys/templates/yardoc.rb', line 283 def (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.
180 181 182 |
# File 'lib/toys/templates/yardoc.rb', line 180 def output_dir=(value) @output_dir = value end |
#readme=(value) ⇒ String?
Name of the readme file used as the title page.
If set to nil
, YARD will choose a default.
239 240 241 |
# File 'lib/toys/templates/yardoc.rb', line 239 def readme=(value) @readme = value end |
#show_private=(value) ⇒ Boolean
Whether to document private methods.
222 223 224 |
# File 'lib/toys/templates/yardoc.rb', line 222 def show_private=(value) @show_private = value end |
#show_protected=(value) ⇒ Boolean
Whether to document protected methods.
214 215 216 |
# File 'lib/toys/templates/yardoc.rb', line 214 def show_protected=(value) @show_protected = value end |
#show_public=(value) ⇒ Boolean
Whether to document public methods.
206 207 208 |
# File 'lib/toys/templates/yardoc.rb', line 206 def show_public=(value) @show_public = value end |
#stats_options=(value) ⇒ Array<String>
Additional stats options to pass to YARD
291 292 293 |
# File 'lib/toys/templates/yardoc.rb', line 291 def (value) @stats_options = value end |
#template=(value) ⇒ String?
Template to use.
If set to nil
, YARD will choose a default.
257 258 259 |
# File 'lib/toys/templates/yardoc.rb', line 257 def template=(value) @template = value end |
#template_path=(value) ⇒ String?
Directory path to look for templates in.
If set to nil
, no additional template lookup paths will be used.
266 267 268 |
# File 'lib/toys/templates/yardoc.rb', line 266 def template_path=(value) @template_path = value end |
Instance Method Details
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
See the documentation for the bundler mixin for information on the options that can be passed.
324 325 326 327 |
# File 'lib/toys/templates/yardoc.rb', line 324 def use_bundler(**opts) @bundler = opts self end |