From e030f38158a79558a93062cd474e559124fb7494 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 19 Jul 2000 08:04:52 +0000 Subject: matz git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cgi-lib.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/cgi-lib.rb') diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb index bf0460123..ffe3fcf36 100644 --- a/lib/cgi-lib.rb +++ b/lib/cgi-lib.rb @@ -121,7 +121,7 @@ class CGI < SimpleDelegator RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ] # make rfc1123 date string - def rfc1123_date(time) + def CGI::rfc1123_date(time) t = time.clone.gmtime return format("%s, %.2d %s %d %.2d:%.2d:%.2d GMT", RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year, @@ -129,22 +129,20 @@ class CGI < SimpleDelegator end # escape url encode - def escape(str) + def CGI::escape(str) str.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) } end # unescape url encoded - def unescape(str) + def CGI::unescape(str) str.gsub(/\+/, ' ').gsub(/%([0-9a-fA-F]{2})/){ [$1.hex].pack("c") } end # escape HTML - def escapeHTML(str) + def CGI::escapeHTML(str) str.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/