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

ruby-changes:28735

From: xibbar <ko1@a...>
Date: Thu, 16 May 2013 19:16:14 +0900 (JST)
Subject: [ruby-changes:28735] xibbar:r40787 (trunk): * lib/cgi/core.rb: Constant parameter is faster and economy than

xibbar	2013-05-16 19:14:45 +0900 (Thu, 16 May 2013)

  New Revision: 40787

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

  Log:
    * lib/cgi/core.rb: Constant parameter is faster and economy than
      string parameter.

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

Index: lib/cgi/core.rb
===================================================================
--- lib/cgi/core.rb	(revision 40786)
+++ lib/cgi/core.rb	(revision 40787)
@@ -587,14 +587,14 @@ class CGI https://github.com/ruby/ruby/blob/trunk/lib/cgi/core.rb#L587
     def create_body(is_large)  #:nodoc:
       if is_large
         require 'tempfile'
-        body = Tempfile.new('CGI', encoding: "ascii-8bit")
+        body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
       else
         begin
           require 'stringio'
-          body = StringIO.new("".force_encoding("ascii-8bit"))
+          body = StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
         rescue LoadError
           require 'tempfile'
-          body = Tempfile.new('CGI', encoding: "ascii-8bit")
+          body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
         end
       end
       body.binmode if defined? body.binmode
@@ -701,9 +701,9 @@ class CGI https://github.com/ruby/ruby/blob/trunk/lib/cgi/core.rb#L701
         if value
           return value
         elsif defined? StringIO
-          StringIO.new("".force_encoding("ascii-8bit"))
+          StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
         else
-          Tempfile.new("CGI",encoding:"ascii-8bit")
+          Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT)
         end
       else
         str = if value then value.dup else "" end

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

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