Class: GLI::GLIOptionParser::GlobalOptionParser
- Inherits:
-
Object
- Object
- GLI::GLIOptionParser::GlobalOptionParser
- Defined in:
- lib/gli/gli_option_parser.rb
Instance Attribute Summary collapse
-
#cli_options ⇒ Object
readonly
Returns the value of attribute cli_options.
Instance Method Summary collapse
-
#initialize(option_parser_factory, command_finder) ⇒ GlobalOptionParser
constructor
A new instance of GlobalOptionParser.
- #parse!(parsing_result) ⇒ Object
Constructor Details
#initialize(option_parser_factory, command_finder) ⇒ GlobalOptionParser
Returns a new instance of GlobalOptionParser.
27 28 29 30 |
# File 'lib/gli/gli_option_parser.rb', line 27 def initialize(option_parser_factory,command_finder) @option_parser_factory = option_parser_factory @command_finder = command_finder end |
Instance Attribute Details
#cli_options ⇒ Object (readonly)
Returns the value of attribute cli_options.
25 26 27 |
# File 'lib/gli/gli_option_parser.rb', line 25 def @cli_options end |
Instance Method Details
#parse!(parsing_result) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gli/gli_option_parser.rb', line 32 def parse!(parsing_result) parsing_result.arguments = GLIOptionBlockParser.new(@option_parser_factory,UnknownGlobalArgument).parse!(parsing_result.arguments) @cli_options = { :global => @option_parser_factory..dup, "commands" => {} } parsing_result. = @option_parser_factory. command_name = if parsing_result.[:help] "help" else parsing_result.arguments.shift end parsing_result.command = @command_finder.find_command(command_name) parsing_result end |