summaryrefslogtreecommitdiff
path: root/lib/cgi-lib.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-03-20 09:20:30 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-03-20 09:20:30 +0000
commit3d699ae9ffc32665e8f9117c4149e2ae03123bdf (patch)
tree3c1a24bf6edd888510370d62650def9760769ded /lib/cgi-lib.rb
parente31a0443ceb78acbc46f9328da58d204f320dd22 (diff)
-a -> -a- ^^;;
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi-lib.rb')
-rw-r--r--lib/cgi-lib.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb
index 02720b28353..00be8992f40 100644
--- a/lib/cgi-lib.rb
+++ b/lib/cgi-lib.rb
@@ -7,14 +7,16 @@
# foo = CGI.new
# foo['field'] <== value of 'field'
# foo.keys <== array of fields
-# foo.inputs <== hash of { <field> => <value> }
+# and foo has Hash class methods
# if running on Windows(IIS or PWS) then change cwd.
if ENV['SERVER_SOFTWARE'] =~ /^Microsoft-/ then
Dir.chdir ENV['PATH_TRANSLATED'].sub(/[^\\]+$/, '')
end
-class CGI
+require "delegate"
+
+class CGI < SimpleDelegator
attr("inputs")
@@ -61,16 +63,10 @@ class CGI
key, val = x.split(/=/,2).collect{|x|unescape(x)}
@inputs[key] += ("\0" if @inputs[key]) + (val or "")
end
- end
- def keys
- @inputs.keys
+ super(@inputs)
end
- def [](key)
- @inputs[key]
- end
-
def CGI.message(msg, title = "")
print "Content-type: text/html\n\n"
print "<html><head><title>"