Skip to content

Instantly share code, notes, and snippets.

@codatory
Created October 30, 2013 19:35
Show Gist options
  • Save codatory/7238812 to your computer and use it in GitHub Desktop.
Save codatory/7238812 to your computer and use it in GitHub Desktop.
require 'ap'
options = Hash.new(nil)
key = nil
ARGV.each do |arg|
arg = arg.dup
if arg.gsub!(/^--/, '')
key = arg.to_sym
options[key] = true
else
if key
options[key] = arg
key = nil
end
end
end
ap options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment