Skip to content

Instantly share code, notes, and snippets.

@tatey
Forked from ThisIsMissEm/gist:325062
Created March 8, 2010 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tatey/325073 to your computer and use it in GitHub Desktop.
Save tatey/325073 to your computer and use it in GitHub Desktop.
def get_options(args)
args.inject({}) do |args, arg|
if arg =~ /^--(\w+)/
key, value = $1.split('=')
args[key] = value
elsif arg =~ /^-(\w+)/
options[$1.match(/(\w+)$/)[1]] = !$1.match(/^no-/)
end
args
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment