Class: Hotspots::OptionsParser
- Inherits:
-
Object
- Object
- Hotspots::OptionsParser
- Defined in:
- lib/hotspots/options_parser.rb
Overview
:nodoc: all
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ OptionsParser
constructor
A new instance of OptionsParser.
- #parse(*args) ⇒ Object
Constructor Details
#initialize ⇒ OptionsParser
Returns a new instance of OptionsParser.
23 24 25 |
# File 'lib/hotspots/options_parser.rb', line 23 def initialize @options = self.class. end |
Class Method Details
.default_options ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/hotspots/options_parser.rb', line 9 def { :time => 15, :repository => ".", :file_filter => "", :message_filters => [""], :cutoff => 0, :verbose => false, :exit_strategy => OptionBasedExit::Noop.new, :colour => false, } end |
Instance Method Details
#parse(*args) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/hotspots/options_parser.rb', line 27 def parse(*args) parser = new_option_parser begin parser.parse args rescue ::OptionParser::InvalidOption, ::OptionParser::InvalidArgument => ex @options[:exit_strategy] = OptionBasedExit::Error.new(:code => 1, :message => (ex.to_s << "\nUse -h for help\n")) end @options end |