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.
6 7 8 |
# File 'lib/raheui/option.rb', line 6 def initialize @options = {} 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.
16 17 18 19 20 21 22 23 |
# File 'lib/raheui/option.rb', line 16 def parse(args) OptionParser.new do |opts| opts. = 'Usage: raheui [options] [file]' (opts) end.parse!(args) [@options, args] end |