aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r--activesupport/lib/active_support/dependencies.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index e0d2b70306..5091abc3a4 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -484,8 +484,10 @@ module ActiveSupport #:nodoc:
end
class Reference
- def initialize(constant, name)
- @constant, @name = constant, name
+ attr_reader :name
+
+ def initialize(name, constant = nil)
+ @name, @constant = name, constant
end
def get
@@ -498,7 +500,11 @@ module ActiveSupport #:nodoc:
end
def ref(name)
- references[name] ||= Reference.new(Inflector.constantize(name), name)
+ references[name] ||= Reference.new(name)
+ end
+
+ def constantize(name)
+ ref(name).get
end
# Determine if the given constant has been automatically loaded.