Class: YARD::CLI::YardoptsCommand Abstract
- Defined in:
- lib/yard/cli/yardopts_command.rb
Overview
This class is abstract.
Abstract base class for command that reads .yardopts file
Constant Summary collapse
- DEFAULT_YARDOPTS_FILE =
The configuration filename to load extra options from
".yardopts"
Instance Attribute Summary collapse
-
#options_file ⇒ String
The options file name (defaults to DEFAULT_YARDOPTS_FILE).
-
#use_document_file ⇒ Boolean
Whether to parse options from .document.
-
#use_yardopts_file ⇒ Boolean
Whether to parse options from .yardopts.
Instance Method Summary collapse
-
#initialize ⇒ YardoptsCommand
constructor
Creates a new command that reads .yardopts.
-
#parse_arguments(*args) ⇒ Boolean
Parses commandline arguments.
-
#yardopts_options(opts) ⇒ Object
protected
Adds –[no-]yardopts / –[no-]document.
Constructor Details
#initialize ⇒ YardoptsCommand
Creates a new command that reads .yardopts
25 26 27 28 29 30 |
# File 'lib/yard/cli/yardopts_command.rb', line 25 def initialize super @options_file = DEFAULT_YARDOPTS_FILE @use_yardopts_file = true @use_document_file = true end |
Instance Attribute Details
#options_file ⇒ String
The options file name (defaults to DEFAULT_YARDOPTS_FILE)
22 23 24 |
# File 'lib/yard/cli/yardopts_command.rb', line 22 def @options_file end |
#use_document_file ⇒ Boolean
Returns whether to parse options from .document.
18 19 20 |
# File 'lib/yard/cli/yardopts_command.rb', line 18 def use_document_file @use_document_file end |
#use_yardopts_file ⇒ Boolean
Returns whether to parse options from .yardopts.
15 16 17 |
# File 'lib/yard/cli/yardopts_command.rb', line 15 def use_yardopts_file @use_yardopts_file end |
Instance Method Details
#parse_arguments(*args) ⇒ Boolean
Parses commandline arguments
36 37 38 39 40 41 42 43 |
# File 'lib/yard/cli/yardopts_command.rb', line 36 def parse_arguments(*args) (*args) # Parse files and then command line arguments parse_rdoc_document_file parse_yardopts optparse(*args) end |
#yardopts_options(opts) ⇒ Object (protected)
Adds –[no-]yardopts / –[no-]document
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/yard/cli/yardopts_command.rb', line 48 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 |