Class: Toys::Templates::Yardoc
- Inherits:
-
Object
- Object
- Toys::Templates::Yardoc
- Includes:
- 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.
-
#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) ⇒ Yardoc
constructor
Create the template settings for the Yardoc template.
-
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
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) ⇒ Yardoc
Create the template settings for the Yardoc template.
82 83 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 |
# File 'lib/toys/templates/yardoc.rb', line 82 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) @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 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.
300 301 302 |
# File 'lib/toys/templates/yardoc.rb', line 300 def bundler=(value) @bundler = value end |
#fail_on_undocumented_objects=(value) ⇒ Boolean
Whether the tool should return a nonzero error code if any objects remain undocumented.
194 195 196 |
# File 'lib/toys/templates/yardoc.rb', line 194 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.
185 186 187 |
# File 'lib/toys/templates/yardoc.rb', line 185 def fail_on_warning=(value) @fail_on_warning = value end |
#files=(value) ⇒ Array<String>
An array of globs indicating which files to document.
149 150 151 |
# File 'lib/toys/templates/yardoc.rb', line 149 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".
271 272 273 |
# File 'lib/toys/templates/yardoc.rb', line 271 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.
141 142 143 |
# File 'lib/toys/templates/yardoc.rb', line 141 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.
158 159 160 |
# File 'lib/toys/templates/yardoc.rb', line 158 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.
167 168 169 |
# File 'lib/toys/templates/yardoc.rb', line 167 def generate_output_flag=(value) @generate_output_flag = value end |
#hide_private_tag=(value) ⇒ Boolean
Whether to hide methods with the @private
tag.
226 227 228 |
# File 'lib/toys/templates/yardoc.rb', line 226 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".
244 245 246 |
# File 'lib/toys/templates/yardoc.rb', line 244 def markup=(value) @markup = value end |
#name=(value) ⇒ String
Name of the tool to create.
130 131 132 |
# File 'lib/toys/templates/yardoc.rb', line 130 def name=(value) @name = value end |
#options=(value) ⇒ Array<String>
Additional options to pass to YARD
279 280 281 |
# File 'lib/toys/templates/yardoc.rb', line 279 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.
176 177 178 |
# File 'lib/toys/templates/yardoc.rb', line 176 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.
235 236 237 |
# File 'lib/toys/templates/yardoc.rb', line 235 def readme=(value) @readme = value end |
#show_private=(value) ⇒ Boolean
Whether to document private methods.
218 219 220 |
# File 'lib/toys/templates/yardoc.rb', line 218 def show_private=(value) @show_private = value end |
#show_protected=(value) ⇒ Boolean
Whether to document protected methods.
210 211 212 |
# File 'lib/toys/templates/yardoc.rb', line 210 def show_protected=(value) @show_protected = value end |
#show_public=(value) ⇒ Boolean
Whether to document public methods.
202 203 204 |
# File 'lib/toys/templates/yardoc.rb', line 202 def show_public=(value) @show_public = value end |
#stats_options=(value) ⇒ Array<String>
Additional stats options to pass to YARD
287 288 289 |
# File 'lib/toys/templates/yardoc.rb', line 287 def (value) @stats_options = value end |
#template=(value) ⇒ String?
Template to use.
If set to nil
, YARD will choose a default.
253 254 255 |
# File 'lib/toys/templates/yardoc.rb', line 253 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.
262 263 264 |
# File 'lib/toys/templates/yardoc.rb', line 262 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.
312 313 314 315 |
# File 'lib/toys/templates/yardoc.rb', line 312 def use_bundler(**opts) @bundler = opts self end |