Permalink
Browse files

yo dawg, directly use the class cache rather than the cache of the cache

  • Loading branch information...
1 parent 7b6bfe8 commit f345e2380cac2560f3bbd80defe1ef485e0d564e @tenderlove tenderlove committed Mar 2, 2011
@@ -8,11 +8,12 @@ class Middleware
def initialize(klass_or_name, *args, &block)
@klass = nil
- @name = klass_or_name
if klass_or_name.respond_to?(:name)
@klass = klass_or_name
@name = @klass.name
+ else
+ @name = klass_or_name.to_s
end
@args, @block = args, block
@@ -47,9 +47,6 @@ module Dependencies #:nodoc:
mattr_accessor :autoloaded_constants
self.autoloaded_constants = []
- mattr_accessor :references
- self.references = {}
-
# An array of constant names that need to be unloaded on every request. Used
# to allow arbitrary constants to be marked for unloading.
mattr_accessor :explicitly_unloadable_constants
@@ -565,11 +562,11 @@ def clear!
Reference = ClassCache.new
def ref(name)
- references[name] ||= Reference.new(name)
+ Reference.new(name)
end
def constantize(name)
- ref(name).get(name)
+ Reference.get(name)
end
# Determine if the given constant has been automatically loaded.

0 comments on commit f345e23

Please sign in to comment.