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

ruby-changes:24478

From: naruse <ko1@a...>
Date: Wed, 25 Jul 2012 09:20:14 +0900 (JST)
Subject: [ruby-changes:24478] naruse:r36529 (trunk): * lib/cgi/html.rb (element_init): suppress redefine warning.

naruse	2012-07-25 09:19:09 +0900 (Wed, 25 Jul 2012)

  New Revision: 36529

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

  Log:
    * lib/cgi/html.rb (element_init): suppress redefine warning.
      Don't define methods if they are already defined.

  Modified files:
    trunk/ChangeLog
    trunk/lib/cgi/html.rb
    trunk/test/cgi/test_cgi_core.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36528)
+++ ChangeLog	(revision 36529)
@@ -1,3 +1,8 @@
+Wed Jul 25 09:16:26 2012  NARUSE, Yui  <naruse@r...>
+
+	* lib/cgi/html.rb (element_init): suppress redefine warning.
+	  Don't define methods if they are already defined.
+
 Wed Jul 25 09:05:38 2012  Eric Hodel  <drbrain@s...>
 
 	* lib/net/http.rb:  Added SSL session reuse across connections for a
Index: lib/cgi/html.rb
===================================================================
--- lib/cgi/html.rb	(revision 36528)
+++ lib/cgi/html.rb	(revision 36529)
@@ -845,6 +845,7 @@
     # Initialise the HTML generation methods for this version.
     def element_init
       extend TagMaker
+      return if defined?(html)
       methods = ""
       # - -
       for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG
@@ -895,6 +896,7 @@
     # Initialise the HTML generation methods for this version.
     def element_init
       extend TagMaker
+      return if defined?(html)
       methods = ""
       # - -
       for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD
@@ -944,6 +946,7 @@
     # Initialise the HTML generation methods for this version.
     def element_init
       extend TagMaker
+      return if defined?(html)
       methods = ""
       # - -
       for element in %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN
@@ -994,6 +997,7 @@
 
     # Initialise the HTML generation methods for this version.
     def element_init
+      return if defined?(frameset)
       methods = ""
       # - -
       for element in %w[ FRAMESET ]
Index: test/cgi/test_cgi_core.rb
===================================================================
--- test/cgi/test_cgi_core.rb	(revision 36528)
+++ test/cgi/test_cgi_core.rb	(revision 36529)
@@ -183,7 +183,7 @@
     }
     ENV.update(@environ)
     ex = assert_raise(StandardError) do
-      cgi = CGI.new
+      CGI.new
     end
     assert_equal("too large post data.", ex.message)
   end if CGI.const_defined?(:MAX_CONTENT_LENGTH)
@@ -304,7 +304,7 @@
         HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST
         HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT
     ]
-    list2 = %w[ CONTENT_LENGTH SERVER_PORT ]
+    # list2 = %w[ CONTENT_LENGTH SERVER_PORT ]
     ## string expected
     list1.each do |name|
       @environ[name] = "**#{name}**"

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

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