[前][次][番号順一覧][スレッド一覧]

ruby-changes:19836

From: drbrain <ko1@a...>
Date: Wed, 1 Jun 2011 09:44:42 +0900 (JST)
Subject: [ruby-changes:19836] drbrain:r31882 (trunk): * lib/cgi/util.rb: Improve documentation. Patch by Kuba Fietkiewicz.

drbrain	2011-06-01 09:42:06 +0900 (Wed, 01 Jun 2011)

  New Revision: 31882

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31882

  Log:
    * lib/cgi/util.rb:  Improve documentation.  Patch by Kuba Fietkiewicz.
      [Ruby 1.9 - Bug #4775]
    * lib/cgi/core.rb:  ditto

  Modified files:
    trunk/ChangeLog
    trunk/lib/cgi/core.rb
    trunk/lib/cgi/util.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31881)
+++ ChangeLog	(revision 31882)
@@ -1,3 +1,9 @@
+Wed Jun  1 09:41:14 2011  Eric Hodel  <drbrain@s...>
+
+	* lib/cgi/util.rb:  Improve documentation.  Patch by Kuba Fietkiewicz.
+	  [Ruby 1.9 - Bug #4775]
+	* lib/cgi/core.rb:  ditto
+
 Wed Jun  1 09:26:05 2011  Eric Hodel  <drbrain@s...>
 
 	* lib/mathn.rb:  Improve documentation and attach it to Numeric.
Index: lib/cgi/util.rb
===================================================================
--- lib/cgi/util.rb	(revision 31881)
+++ lib/cgi/util.rb	(revision 31882)
@@ -9,7 +9,6 @@
     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 @@
     str.valid_encoding? ? str : str.force_encoding(string.encoding)
   end
 
+  # The set of special characters and their escaped values
   TABLE_FOR_ESCAPE_HTML__ = {
     '&' => '&amp;',
     '"' => '&quot;',
@@ -34,7 +34,6 @@
     string.gsub(/[&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
   end
 
-
   # Unescape a string that has been HTML-escaped
   #   CGI::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
   #      # => "Usage: foo \"bar\" <baz>"
@@ -84,12 +83,12 @@
     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 @@
     end
   end
 
-
   # Undo escaping such as that done by CGI::escapeElement()
   #
   #   print CGI::unescapeElement(
@@ -139,12 +137,12 @@
     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
Index: lib/cgi/core.rb
===================================================================
--- lib/cgi/core.rb	(revision 31881)
+++ lib/cgi/core.rb	(revision 31882)
@@ -17,6 +17,7 @@
 
   REVISION = '$Id$' #:nodoc:
 
+  # Whether processing will be required in binary vs text
   NEEDS_BINMODE = File::BINARY != 0
 
   # Path separators in different environments.
@@ -450,6 +451,15 @@
       @params.update(hash)
     end
 
+    ##
+    # Parses multipart form elements according to 
+    #   http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
+    #
+    # Returns a hash of multipart form parameters with bodies of type StringIO or 
+    # Tempfile depending on whether the multipart form element exceeds 10 KB
+    #
+    #   params[name => body]
+    #
     def read_multipart(boundary, content_length)
       ## read first boundary
       stdin = $stdin
@@ -655,6 +665,7 @@
     end
     private :initialize_query
 
+    # Returns whether the form contained multipart/form-data
     def multipart?
       @multipart
     end
@@ -705,7 +716,6 @@
   #
   #   CGI.accept_charset = "EUC-JP"
   #
-
   @@accept_charset="UTF-8"
 
   # Return the accept character set for all new CGI instances.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]