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

ruby-changes:25631

From: marcandre <ko1@a...>
Date: Sat, 17 Nov 2012 01:55:40 +0900 (JST)
Subject: [ruby-changes:25631] marcandRe: r37688 (trunk): * lib/cgi/core.rb: Use symbols instead of strings for

marcandre	2012-11-17 01:55:29 +0900 (Sat, 17 Nov 2012)

  New Revision: 37688

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

  Log:
    * lib/cgi/core.rb: Use symbols instead of strings for
      {const_,instance_variable_}{get,set}. [#7161]
    
    * lib/drb/drb.rb: ditto.
    
    * lib/ipaddr.rb: ditto.
    
    * lib/irb/workspace.rb: ditto.
    
    * lib/monitor.rb: ditto.
    
    * lib/rss/maker/base.rb: ditto.
    
    * lib/rss/rss.rb: ditto.
    
    * lib/xmlrpc/parser.rb: ditto.

  Modified files:
    trunk/lib/cgi/core.rb
    trunk/lib/drb/drb.rb
    trunk/lib/ipaddr.rb
    trunk/lib/irb/workspace.rb
    trunk/lib/monitor.rb
    trunk/lib/rss/maker/base.rb
    trunk/lib/rss/rss.rb
    trunk/lib/xmlrpc/parser.rb

Index: lib/xmlrpc/parser.rb
===================================================================
--- lib/xmlrpc/parser.rb	(revision 37687)
+++ lib/xmlrpc/parser.rb	(revision 37688)
@@ -650,10 +650,10 @@
         if defined? XML::DOM::Builder
           return if defined? XML::DOM::Node::DOCUMENT # code below has been already executed
           klass = XML::DOM::Node
-          klass.const_set("DOCUMENT", klass::DOCUMENT_NODE)
-          klass.const_set("TEXT", klass::TEXT_NODE)
-          klass.const_set("COMMENT", klass::COMMENT_NODE)
-          klass.const_set("ELEMENT", klass::ELEMENT_NODE)
+          klass.const_set(:DOCUMENT, klass::DOCUMENT_NODE)
+          klass.const_set(:TEXT, klass::TEXT_NODE)
+          klass.const_set(:COMMENT, klass::COMMENT_NODE)
+          klass.const_set(:ELEMENT, klass::ELEMENT_NODE)
         end
       end
 
Index: lib/monitor.rb
===================================================================
--- lib/monitor.rb	(revision 37687)
+++ lib/monitor.rb	(revision 37688)
@@ -107,7 +107,7 @@
       @monitor.__send__(:mon_check_owner)
       count = @monitor.__send__(:mon_exit_for_cond)
       begin
-        @cond.wait(@monitor.instance_variable_get("@mon_mutex"), timeout)
+        @cond.wait(@monitor.instance_variable_get(:@mon_mutex), timeout)
         return true
       ensure
         @monitor.__send__(:mon_enter_for_cond, count)
Index: lib/ipaddr.rb
===================================================================
--- lib/ipaddr.rb	(revision 37687)
+++ lib/ipaddr.rb	(revision 37688)
@@ -607,7 +607,7 @@
 
 end
 
-unless Socket.const_defined? "AF_INET6"
+unless Socket.const_defined? :AF_INET6
   class Socket < BasicSocket
     # IPv6 protocol family
     AF_INET6 = Object.new
Index: lib/rss/maker/base.rb
===================================================================
--- lib/rss/maker/base.rb	(revision 37687)
+++ lib/rss/maker/base.rb	(revision 37688)
@@ -23,8 +23,8 @@
         end
 
         def inherited(subclass)
-          subclass.const_set("OTHER_ELEMENTS", [])
-          subclass.const_set("NEED_INITIALIZE_VARIABLES", [])
+          subclass.const_set(:OTHER_ELEMENTS, [])
+          subclass.const_set(:NEED_INITIALIZE_VARIABLES, [])
         end
 
         def add_other_element(variable_name)
Index: lib/rss/rss.rb
===================================================================
--- lib/rss/rss.rb	(revision 37687)
+++ lib/rss/rss.rb	(revision 37688)
@@ -701,18 +701,18 @@
       end
 
       def inherited(klass)
-        klass.const_set("MUST_CALL_VALIDATORS", {})
-        klass.const_set("MODELS", [])
-        klass.const_set("GET_ATTRIBUTES", [])
-        klass.const_set("HAVE_CHILDREN_ELEMENTS", [])
-        klass.const_set("TO_ELEMENT_METHODS", [])
-        klass.const_set("NEED_INITIALIZE_VARIABLES", [])
-        klass.const_set("PLURAL_FORMS", {})
+        klass.const_set(:MUST_CALL_VALIDATORS, {})
+        klass.const_set(:MODELS, [])
+        klass.const_set(:GET_ATTRIBUTES, [])
+        klass.const_set(:HAVE_CHILDREN_ELEMENTS, [])
+        klass.const_set(:TO_ELEMENT_METHODS, [])
+        klass.const_set(:NEED_INITIALIZE_VARIABLES, [])
+        klass.const_set(:PLURAL_FORMS, {})
 
         tag_name = klass.name.split(/::/).last
         tag_name[0, 1] = tag_name[0, 1].downcase
-        klass.instance_variable_set("@tag_name", tag_name)
-        klass.instance_variable_set("@have_content", false)
+        klass.instance_variable_set(:@tag_name, tag_name)
+        klass.instance_variable_set(:@have_content, false)
       end
 
       def install_must_call_validator(prefix, uri)
Index: lib/irb/workspace.rb
===================================================================
--- lib/irb/workspace.rb	(revision 37687)
+++ lib/irb/workspace.rb	(revision 37688)
@@ -38,7 +38,7 @@
 	  unless defined? BINDING_QUEUE
 	    require "thread"
 
-	    IRB.const_set("BINDING_QUEUE", SizedQueue.new(1))
+	    IRB.const_set(:BINDING_QUEUE, SizedQueue.new(1))
 	    Thread.abort_on_exception = true
 	    Thread.start do
 	      eval "require \"irb/ws-for-case-2\"", TOPLEVEL_BINDING, __FILE__, __LINE__
Index: lib/cgi/core.rb
===================================================================
--- lib/cgi/core.rb	(revision 37687)
+++ lib/cgi/core.rb	(revision 37688)
@@ -533,11 +533,11 @@
         /Content-Disposition:.* filename=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
         filename = $1 || $2 || ''
         filename = CGI.unescape(filename) if unescape_filename?()
-        body.instance_variable_set('@original_filename', filename.taint)
+        body.instance_variable_set(:@original_filename, filename.taint)
         ## content type
         /Content-Type: (.*)/i.match(head)
         (content_type = $1 || '').chomp!
-        body.instance_variable_set('@content_type', content_type.taint)
+        body.instance_variable_set(:@content_type, content_type.taint)
         ## query parameter name
         /Content-Disposition:.* name=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
         name = $1 || $2 || ''
Index: lib/drb/drb.rb
===================================================================
--- lib/drb/drb.rb	(revision 37687)
+++ lib/drb/drb.rb	(revision 37688)
@@ -1010,8 +1010,8 @@
 
     def self.new_with(uri, ref)
       it = self.allocate
-      it.instance_variable_set('@uri', uri)
-      it.instance_variable_set('@ref', ref)
+      it.instance_variable_set(:@uri, uri)
+      it.instance_variable_set(:@ref, ref)
       it
     end
 

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

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