diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-18 00:42:18 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-18 00:42:18 +0000 |
| commit | 9bf4771c1cc389a3d2dc74ab77df2c314b0b950b (patch) | |
| tree | d46b69aff87e19a794a9d6e57bd92173253ccefe /lib | |
| parent | 03d829620158f7ed14270f1d2aeb908fd935ebf8 (diff) | |
| download | ruby-9bf4771c1cc389a3d2dc74ab77df2c314b0b950b.tar.gz ruby-9bf4771c1cc389a3d2dc74ab77df2c314b0b950b.tar.xz ruby-9bf4771c1cc389a3d2dc74ab77df2c314b0b950b.zip | |
* lib/optparse.rb (OptionParser::make_switch): makes default
conversion to splat. [ruby-list:45645]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/optparse.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index 5a86194b7..0548a29ca 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -996,6 +996,7 @@ class OptionParser end private :notwice + SPLAT_PROC = proc {|*a| a} # # Creates an OptionParser::Switch from the parameters. The parsed argument # value is passed to the given block, where it can be processed. @@ -1076,7 +1077,11 @@ class OptionParser # directly specified pattern(any object possible to match) if (!(String === o || Symbol === o)) and o.respond_to?(:match) pattern = notwice(o, pattern, 'pattern') - conv = pattern.method(:convert).to_proc if pattern.respond_to?(:convert) + if pattern.respond_to?(:convert) + conv = pattern.method(:convert).to_proc + else + conv = SPLAT_PROC + end next end |
