* lib/optparse.rb (make_switch): do not clobber converter if pattern

has no convert method.  reported by sheepman in [ruby-dev:30709].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-04-16 08:07:20 +00:00
Родитель ffa31c2645
Коммит 0a612b8807
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Mon Apr 16 17:08:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (make_switch): do not clobber converter if pattern
has no convert method. reported by sheepman in [ruby-dev:30709].
Mon Apr 16 16:49:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/stringio/stringio.c (strio_seek): consistent behavior with

Просмотреть файл

@ -1076,7 +1076,7 @@ class OptionParser
# directly specified pattern(any object possible to match)
if !(String === o) and o.respond_to?(:match)
pattern = notwice(o, pattern, 'pattern')
conv = (pattern.method(:convert).to_proc if pattern.respond_to?(:convert))
conv ||= pattern.method(:convert).to_proc if pattern.respond_to?(:convert)
next
end
@ -1089,7 +1089,7 @@ class OptionParser
when CompletingHash
when nil
pattern = CompletingHash.new
conv = (pattern.method(:convert).to_proc if pattern.respond_to?(:convert))
conv ||= pattern.method(:convert).to_proc if pattern.respond_to?(:convert)
else
raise ArgumentError, "argument pattern given twice"
end