Class: ArgumentParser

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

Instance Method Summary collapse

Instance Method Details

#newObject



2
3
4
# File 'lib/argument_parser.rb', line 2

def new
  @instance ||= super
end

#parse_arguments(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/argument_parser.rb', line 6

def parse_arguments(args)
  last = args.pop
  array = args
  hash = {}
  if last.is_a?(Hash)
    hash = last
  elsif last
    array << last
  end
  [array, hash]
end