# File lib/getoptions.rb, line 143 def initialize(option_specs, input = ARGV) build_dict(option_specs) @options = {} leftover = [] until input.empty? arg = input.shift case arg # Stop if you hit -- when '--' break # Long form when /^--(\S+)/ o, a = $1.split('=', 2) input.unshift(a) if a input = process_arguments(o, input) # Short form when /^-(\S+)/ o, a = $1.split('=', 2) input.unshift(a) if a o.scan(/./) do |c| input = process_arguments(c, input) end # Not an option, leave it else leftover << arg end end # Put what didn't parse back into input input.concat(leftover) end