aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorBrian Cardarella <bcardarella@gmail.com>2013-06-10 23:22:08 -0400
committerBrian Cardarella <bcardarella@gmail.com>2013-06-10 23:22:08 -0400
commit748d3f38df5d32c5e1eb1d82c07b8abffbb44973 (patch)
treefc02c2116093b3d7cf79269eabbb90a0e7758781 /activesupport
parentebf2113a0565d2e38802f29291b3971b2c7f7922 (diff)
downloadrails-748d3f38df5d32c5e1eb1d82c07b8abffbb44973.tar.gz
rails-748d3f38df5d32c5e1eb1d82c07b8abffbb44973.tar.bz2
rails-748d3f38df5d32c5e1eb1d82c07b8abffbb44973.zip
Use symbols instead of strings
ActiveSupport::Concern is used all over Rails This PR will only create 3 new objects as keys are never recreated and are not subject to garbage collection. The strings were being uniquely created and garbage collected. I don't have any performance numbers but this should be better than all of the GC.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/concern.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb
index b6ae86b583..b796d01dfd 100644
--- a/activesupport/lib/active_support/concern.rb
+++ b/activesupport/lib/active_support/concern.rb
@@ -105,25 +105,25 @@ module ActiveSupport
end
def self.extended(base) #:nodoc:
- base.instance_variable_set("@_dependencies", [])
+ base.instance_variable_set(:@_dependencies, [])
end
def append_features(base)
- if base.instance_variable_defined?("@_dependencies")
- base.instance_variable_get("@_dependencies") << self
+ if base.instance_variable_defined?(:@_dependencies)
+ base.instance_variable_get(:@_dependencies) << self
return false
else
return false if base < self
@_dependencies.each { |dep| base.send(:include, dep) }
super
- base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
- base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
+ base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods)
+ base.class_eval(&@_included_block) if instance_variable_defined?(:@_included_block)
end
end
def included(base = nil, &block)
if base.nil?
- raise MultipleIncludedBlocks if instance_variable_defined?("@_included_block")
+ raise MultipleIncludedBlocks if instance_variable_defined?(:@_included_block)
@_included_block = block
else