summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-24 20:49:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-24 20:49:37 +0000
commite7ad51a53a916c97fd9f247eb5d12be975b95beb (patch)
treeb8f662ad2379b44e13eb02804c96359d7e87a361 /lib
parent5ee6b28538452941313f289cac7b25c8a4561f8d (diff)
* lib/un.rb (setup): fix of word splitting. [ruby-dev:41723]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/un.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/un.rb b/lib/un.rb
index 24c6024c71..907b80c0ab 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -43,8 +43,11 @@ def setup(options = "", *long_options)
end
end
long_options.each do |s|
- opt_name = s[/\A(?:--)?([^\s=]+)/, 1].intern
- o.on(s.gsub(/([a-z])([A-Z])/){$1+"-"+$2.downcase}.sub(/\A(?!--)/, '--')) do |val|
+ opt_name, arg_name = s.split(/(?=[\s=])/, 2)
+ opt_name.sub!(/\A--/, '')
+ s = "--#{opt_name.gsub(/([A-Za-z]+)([A-Z])/, '\1-\2').downcase}#{arg_name}"
+ opt_name = opt_name.intern
+ o.on(s) do |val|
opt_hash[opt_name] = val
end
end