diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 00:42:06 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 00:42:06 +0000 |
commit | b8f3f2d62e62fa8ebfd4e59656173813ec96672a (patch) | |
tree | a96d7d09b9d48de11b330a97d306184998a502a9 /lib/cgi/util.rb | |
parent | 5dcb4fc18b38591d111e8c71667e65021b51cbdd (diff) | |
download | ruby-b8f3f2d62e62fa8ebfd4e59656173813ec96672a.tar.gz |
* lib/cgi/util.rb: Improve documentation. Patch by Kuba Fietkiewicz.
[Ruby 1.9 - Bug #4775]
* lib/cgi/core.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi/util.rb')
-rw-r--r-- | lib/cgi/util.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb index e611cbedb2..2bb3b0da78 100644 --- a/lib/cgi/util.rb +++ b/lib/cgi/util.rb @@ -9,7 +9,6 @@ class CGI end.tr(' ', '+') end - # URL-decode a string with encoding(optional). # string = CGI::unescape("%27Stop%21%27+said+Fred") # # => "'Stop!' said Fred" @@ -20,6 +19,7 @@ class CGI str.valid_encoding? ? str : str.force_encoding(string.encoding) end + # The set of special characters and their escaped values TABLE_FOR_ESCAPE_HTML__ = { '&' => '&', '"' => '"', @@ -34,7 +34,6 @@ class CGI string.gsub(/[&\"<>]/, TABLE_FOR_ESCAPE_HTML__) end - # Unescape a string that has been HTML-escaped # CGI::unescapeHTML("Usage: foo "bar" <baz>") # # => "Usage: foo \"bar\" <baz>" @@ -84,12 +83,12 @@ class CGI end end - # Synonym for CGI.escapeHTML. + # Synonym for CGI::escapeHTML(str) def CGI::escape_html(str) escapeHTML(str) end - - # Synonym for CGI.unescapeHTML. + + # Synonym for CGI::unescapeHTML(str) def CGI::unescape_html(str) unescapeHTML(str) end @@ -118,7 +117,6 @@ class CGI end end - # Undo escaping such as that done by CGI::escapeElement() # # print CGI::unescapeElement( @@ -139,12 +137,12 @@ class CGI end end - # Synonym for CGI.escapeElement. + # Synonym for CGI::escapeElement(str) def CGI::escape_element(str) escapeElement(str) end - - # Synonym for CGI.unescapeElement. + + # Synonym for CGI::unescapeElement(str) def CGI::unescape_element(str) unescapeElement(str) end |