summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-29 17:47:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-29 17:47:24 +0000
commitd2793811f3e876139260960672db494b2e287098 (patch)
tree23b84c6d3aa98723fea6577ecedbb3d15a49baba /lib
parent71ceffa3dd8bacca8b61eab4709b32ada6867d5c (diff)
downloadruby-d2793811f3e876139260960672db494b2e287098.tar.gz
ruby-d2793811f3e876139260960672db494b2e287098.tar.xz
ruby-d2793811f3e876139260960672db494b2e287098.zip
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi.rb6
-rw-r--r--lib/optparse.rb1
2 files changed, 3 insertions, 4 deletions
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