aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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 a6003d99a6..43a5aa89f0 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 38958c3f8d..22c03ff5ee 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