diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-24 20:49:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-24 20:49:37 +0000 |
commit | a4d39115034313b70addd078e6997d94c8685064 (patch) | |
tree | 080e04092e9195d42b87ef95f072721d35744608 /lib | |
parent | 430088224994c14f6652f96eafccdbb69ca46e3e (diff) | |
download | ruby-a4d39115034313b70addd078e6997d94c8685064.tar.gz |
* lib/un.rb (setup): fix of word splitting. [ruby-dev:41723]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/un.rb | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |