1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2012-11-16 16:55:29 +00:00
parent f45f668fa1
commit 6f64d9eb56
8 changed files with 22 additions and 22 deletions

View file

@ -533,11 +533,11 @@ class CGI
/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 || ''

View file

@ -1010,8 +1010,8 @@ module DRb
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

View file

@ -607,7 +607,7 @@ class IPAddr
end
unless Socket.const_defined? "AF_INET6"
unless Socket.const_defined? :AF_INET6
class Socket < BasicSocket
# IPv6 protocol family
AF_INET6 = Object.new

View file

@ -38,7 +38,7 @@ EOF
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__

View file

@ -107,7 +107,7 @@ module MonitorMixin
@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)

View file

@ -23,8 +23,8 @@ module RSS
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)

View file

@ -701,18 +701,18 @@ EOC
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)

View file

@ -650,10 +650,10 @@ module XMLRPC # :nodoc:
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