Class: Raheui::Option
- Inherits:
-
Object
- Object
- Raheui::Option
- Defined in:
- lib/raheui/option.rb
Overview
Handle command line options.
Instance Method Summary collapse
-
#initialize ⇒ Option
constructor
Initialize a Option.
-
#parse(args) ⇒ Object
Parse the passed arguments to a Hash.
Constructor Details
#initialize ⇒ Option
Initialize a Option.
9 10 11 |
# File 'lib/raheui/option.rb', line 9 def initialize = {} end |
Instance Method Details
#parse(args) ⇒ Object
Parse the passed arguments to a Hash.
args - An Array of Strings containing options.
Returns an Array consists of a Hash options and an Array of String
remaining arguments.
19 20 21 22 23 24 25 26 |
# File 'lib/raheui/option.rb', line 19 def parse(args) OptionParser.new do |opts| opts. = 'Usage: raheui [options] [file]' (opts) end.parse!(args) [, args] end |