Class: Raheui::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/raheui/option.rb

Overview

Handle command line options.

Instance Method Summary collapse

Constructor Details

#initializeOption

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.banner = 'Usage: raheui [options] [file]'

    add_options(opts)
  end.parse!(args)
  [@options, args]
end