Class: Hotspots::OptionsParser
- Inherits:
-
Object
- Object
- Hotspots::OptionsParser
- Defined in:
- lib/hotspots/options_parser.rb
Overview
:nodoc: all
Instance Method Summary collapse
-
#initialize(opts) ⇒ OptionsParser
constructor
A new instance of OptionsParser.
- #parse(*args) ⇒ Object
Constructor Details
#initialize(opts) ⇒ OptionsParser
5 6 7 |
# File 'lib/hotspots/options_parser.rb', line 5 def initialize(opts) @configuration = opts[:configuration].dup end |
Instance Method Details
#parse(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/hotspots/options_parser.rb', line 9 def parse(*args) parser = new_option_parser begin parser.parse(args) rescue ::OptionParser::InvalidOption, ::OptionParser::InvalidArgument => ex @configuration.exit_strategy = Exit::Error.new(:code => 1, :message => (ex.to_s + "\nUse -h for help\n")) end @configuration end |