From d2793811f3e876139260960672db494b2e287098 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 29 Oct 2003 17:47:24 +0000 Subject: * eval.c (proc_invoke): single array value to normal Proc#call (i.e. not via lambda call), should be treated just like yield. [ruby-dev:21726] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cgi.rb | 6 ++---- lib/optparse.rb | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/cgi.rb b/lib/cgi.rb index a6003d99a..43a5aa89f 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -1152,11 +1152,9 @@ class CGI end alias last first def to_a - @params - end - def to_ary # to be rhs of multiple assignment - @params + @params || [self] end + alias to_ary to_a # to be rhs of multiple assignment end # Get the value for the parameter with a given key. diff --git a/lib/optparse.rb b/lib/optparse.rb index 38958c3f8..22c03ff5e 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -168,6 +168,7 @@ Individual switch class. def initialize(pattern = nil, conv = nil, short = nil, long = nil, arg = nil, desc = ([] if short or long), block = Proc.new) + raise if Array === pattern @pattern, @conv, @short, @long, @arg, @desc, @block = pattern, conv, short, long, arg, desc, block end -- cgit