summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2010-12-13 16:04:53 +0000
committerLee Jarvis <lee@jarvis.co>2010-12-13 16:04:53 +0000
commitc3ff15d5487e00a1bb3e6466559b57a4b5651940 (patch)
treed3e8d9e5d5b6cda6f399a7478bd8f3595b2a9494 /lib
parentdae691979dbdaec5acd46dd980f39086d4e04b0d (diff)
downloadslop-c3ff15d5487e00a1bb3e6466559b57a4b5651940.tar.gz
use better detection of description over option
Diffstat (limited to 'lib')
-rw-r--r--lib/slop.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/slop.rb b/lib/slop.rb
index 24f9961..afb6df8 100644
--- a/lib/slop.rb
+++ b/lib/slop.rb
@@ -191,10 +191,10 @@ class Slop
args.push nil if args.size == 2
args.push false if args.size == 3
- # if the second argument includes a space it's probably a
- # description, so we insert a nil into the option field and
+ # if the second argument includes a space or some odd character it's
+ # probably a description, so we insert a nil into the option field and
# insert the original value into the description field
- args[1..2] = [nil, args[1]] if args[1].to_s.include?(" ")
+ args[1..2] = [nil, args[1]] unless args[1].to_s =~ /\A[a-zA-Z_-]*\z/
# if there's no description given but the option requires an argument, it'll
# probably look like this: `[:f, :option, true]`