summaryrefslogtreecommitdiff
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-02 04:49:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-02 04:49:46 +0000
commit6125313d69c158b423d1f4aff2e206cfd43a036a (patch)
treea1a78a9425305557dcff6569806876989c9098c3 /lib/cgi.rb
parentf5a7f85917abed4d64ad908a4837e0db0499c951 (diff)
* array.c (push_values_at): Array#values_at should work with
ranges too. * range.c (rb_range_beg_len): length calculation was wrong. * eval.c (rb_call): should set T_ICLASS in the frame->last_class. [ruby-core:01110] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb30
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index dfeea5fc47..8f522ab7c1 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -494,7 +494,7 @@ status:
if defined?(MOD_RUBY)
table = Apache::request.headers_out
buf.scan(/([^:]+): (.+)#{EOL}/n){ |name, value|
- $stderr.printf("name:%s value:%s\n", name, value) if $DEBUG
+ warn sprintf("name:%s value:%s\n", name, value) if $DEBUG
case name
when 'Set-Cookie'
table.add(name, value)
@@ -942,24 +942,30 @@ convert string charset, and set language to "ja".
private :initialize_query
class Value < String
- def [](key)
- $stderr.puts <<END
-CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key']
-END
- self
+ def initialize(str, params)
+ @params = params
+ super(str)
+ end
+ def [](idx)
+ p caller(1)
+ warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
+ self
end
def first
- $stderr.puts <<END
-CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key']
-END
- self
+ warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
+ self
+ end
+ alias last first
+ def to_a
+ @params
end
end
def [](key)
- value = @params[key][0]
+ params = @params[key]
+ value = params[0]
value ||= ""
- Value.new(value)
+ Value.new(value,params)
end
def keys(*args)