Explicit dependency on Inflector and Object#blank?

This commit is contained in:
Jeremy Kemper
2009-03-24 19:47:11 -07:00
parent f8dbd416b6
commit cecac31170

View File

@@ -1,4 +1,6 @@
require 'set'
require 'active_support/inflector'
require 'active_support/core_ext/object/blank'
module ActiveSupport #:nodoc:
module Dependencies #:nodoc:
@@ -412,7 +414,7 @@ module ActiveSupport #:nodoc:
# If we have an anonymous module, all we can do is attempt to load from Object.
from_mod = Object if from_mod.name.blank?
unless qualified_const_defined?(from_mod.name) && from_mod.name.constantize.object_id == from_mod.object_id
unless qualified_const_defined?(from_mod.name) && Inflector.constantize(from_mod.name).object_id == from_mod.object_id
raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!"
end
@@ -503,7 +505,7 @@ module ActiveSupport #:nodoc:
# Handle the case where the module has yet to be defined.
initial_constants = if qualified_const_defined?(mod_name)
mod_name.constantize.local_constant_names
Inflector.constantize(mod_name).local_constant_names
else
[]
end
@@ -528,7 +530,7 @@ module ActiveSupport #:nodoc:
# Module still doesn't exist? Treat it as if it has no constants.
next [] unless qualified_const_defined?(mod_name)
mod = mod_name.constantize
mod = Inflector.constantize(mod_name)
next [] unless mod.is_a? Module
new_constants = mod.local_constant_names - prior_constants
@@ -598,7 +600,7 @@ module ActiveSupport #:nodoc:
if names.size == 1 # It's under Object
parent = Object
else
parent = (names[0..-2] * '::').constantize
parent = Inflector.constantize(names[0..-2] * '::')
end
log "removing constant #{const}"