Class: Escort::OptionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/escort/option_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, setup) ⇒ OptionParser


5
6
7
8
# File 'lib/escort/option_parser.rb', line 5

def initialize(configuration, setup)
  @configuration = configuration
  @setup = setup
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration


3
4
5
# File 'lib/escort/option_parser.rb', line 3

def configuration
  @configuration
end

#setupObject (readonly)

Returns the value of attribute setup


3
4
5
# File 'lib/escort/option_parser.rb', line 3

def setup
  @setup
end

Instance Method Details

#parse(cli_options) ⇒ Object


10
11
12
13
14
15
16
# File 'lib/escort/option_parser.rb', line 10

def parse(cli_options)
  options = init_invoked_options_hash
  parse_global_options(cli_options, options[:global][:options])
  parse_command_options(cli_options, [], options[:global][:commands])

  [options, arguments_from(cli_options)]
end