1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2010-06-24 20:49:37 +00:00
parent 5ee6b28538
commit e7ad51a53a
3 changed files with 11 additions and 4 deletions

View file

@ -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