Class: JsDuck::Options::Parser
- Inherits:
-
Object
- Object
- JsDuck::Options::Parser
- Defined in:
- lib/jsduck/options/parser.rb
Overview
Performs parsing of JSDuck options.
Instance Method Summary collapse
-
#initialize(file_class = File, config_class = Options::Config) ⇒ Parser
constructor
A new instance of Parser.
-
#parse(argv) ⇒ Object
Parses array of command line options, returning Options::Record object containing all the options.
Constructor Details
#initialize(file_class = File, config_class = Options::Config) ⇒ Parser
Returns a new instance of Parser.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jsduck/options/parser.rb', line 16 def initialize(file_class=File, config_class=Options::Config) @file = file_class @config = config_class @opts = Options::Record.new @defaults = {} @root_dir = @file.dirname(@file.dirname(@file.dirname(@file.dirname(__FILE__)))) @optparser = Options::HelpfulParser.new init_parser end |
Instance Method Details
#parse(argv) ⇒ Object
Parses array of command line options, returning Options::Record object containing all the options.
31 32 33 34 35 36 |
# File 'lib/jsduck/options/parser.rb', line 31 def parse(argv) init_defaults (argv) auto_detect_config_file unless @opts.config @opts end |