Method: ArgParser::Parser#initialize

Defined in:
lib/arg-parser/parser.rb

#initialize(definition = nil) ⇒ Parser

Instantiates a new command-line parser, with the specified command- line definition. A Parser instance delegates unknown methods to the Definition, so its possible to work only with a Parser instance to both define and parse a command-line.

Parameters:

  • definition (Definition) (defaults to: nil)

    A Definition object that defines the possible arguments that may appear in a command-line. If no definition is supplied, an empty definition is created.



37
38
39
40
# File 'lib/arg-parser/parser.rb', line 37

def initialize(definition = nil)
    @definition = definition || Definition.new
    @errors = []
end