Created
January 12, 2012 14:48
-
-
Save leejarvis/1600937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Slop version 3 | |
require 'slop' | |
opts = Slop.optspec(<<-SPEC) | |
n,name= Your name | |
p,pass=? An optional password | |
A,auth Use authentication (requires password) | |
SPEC | |
opts.parse %w[ --name Lee -p 1c03 ] | |
p opts.fetch_option(:pass).accepts_optional_argument? #=> true | |
p opts.to_hash #=> {:name=>"Lee", :pass=>"1c03", :auth=>nil} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment