Class: YARD::CLI::YardoptsCommand Abstract
- Inherits:
-
Command
- Object
- Command
- YARD::CLI::YardoptsCommand
- Defined in:
- lib/yard/cli/yardopts_command.rb
Overview
This class is abstract.
Abstract base class for command that reads .yardopts file
Constant Summary
- DEFAULT_YARDOPTS_FILE =
The configuration filename to load extra options from
".yardopts"
Instance Attribute Summary (collapse)
-
- (String) options_file
The options file name (defaults to DEFAULT_YARDOPTS_FILE).
-
- (Boolean) use_document_file
Whether to parse options from .document.
-
- (Boolean) use_yardopts_file
Whether to parse options from .yardopts.
Instance Method Summary (collapse)
-
- (YardoptsCommand) initialize
constructor
Creates a new command that reads .yardopts.
-
- (Boolean) parse_arguments(*args)
Parses commandline arguments.
-
- (Object) yardopts_options(opts)
protected
Adds –[no-]yardopts / –[no-]document.
Constructor Details
- (YardoptsCommand) initialize
Creates a new command that reads .yardopts
24 25 26 27 28 29 |
# File 'lib/yard/cli/yardopts_command.rb', line 24 def initialize super @options_file = DEFAULT_YARDOPTS_FILE @use_yardopts_file = true @use_document_file = true end |
Instance Attribute Details
- (String) options_file
The options file name (defaults to DEFAULT_YARDOPTS_FILE)
21 22 23 |
# File 'lib/yard/cli/yardopts_command.rb', line 21 def @options_file end |
- (Boolean) use_document_file
Returns whether to parse options from .document
17 18 19 |
# File 'lib/yard/cli/yardopts_command.rb', line 17 def use_document_file @use_document_file end |
- (Boolean) use_yardopts_file
Returns whether to parse options from .yardopts
14 15 16 |
# File 'lib/yard/cli/yardopts_command.rb', line 14 def use_yardopts_file @use_yardopts_file end |
Instance Method Details
- (Boolean) parse_arguments(*args)
Parses commandline arguments
35 36 37 38 39 40 41 42 |
# File 'lib/yard/cli/yardopts_command.rb', line 35 def parse_arguments(*args) (*args) # Parse files and then command line arguments parse_rdoc_document_file parse_yardopts optparse(*args) end |
- (Object) yardopts_options(opts) (protected)
Adds –[no-]yardopts / –[no-]document
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/yard/cli/yardopts_command.rb', line 47 def (opts) opts.on('--[no-]yardopts [FILE]', "If arguments should be read from FILE", " (defaults to yes, FILE defaults to .yardopts)") do |use_yardopts| if use_yardopts.is_a?(String) self. = use_yardopts self.use_yardopts_file = true else self.use_yardopts_file = (use_yardopts != false) end end opts.on('--[no-]document', "If arguments should be read from .document file. ", " (defaults to yes)") do |use_document| self.use_document_file = use_document end end |