Class: Earthquake::OptionParser
- Inherits:
-
Object
- Object
- Earthquake::OptionParser
- Defined in:
- lib/earthquake/option_parser.rb
Constant Summary collapse
- Help =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(argv) ⇒ OptionParser
constructor
A new instance of OptionParser.
- #parse ⇒ Object
Constructor Details
#initialize(argv) ⇒ OptionParser
Returns a new instance of OptionParser.
8 9 10 11 |
# File 'lib/earthquake/option_parser.rb', line 8 def initialize(argv) @argv = argv @slop = setup_slop end |
Instance Method Details
#parse ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/earthquake/option_parser.rb', line 13 def parse @slop.parse!(@argv) = @slop.to_hash raise Help if .delete(:help) [:dir] = @argv.shift unless @argv.empty? end |