Permalink
Browse files

Explicit dependency on Inflector and Object#blank?

  • Loading branch information...
1 parent f8dbd41 commit cecac31170286e00c99c2cdae5e4dd7404cc6495 @jeremy jeremy committed Mar 25, 2009
Showing with 6 additions and 4 deletions.
  1. +6 −4 activesupport/lib/active_support/dependencies.rb
@@ -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 @@ def load_missing_constant(from_mod, const_name)
# 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 @@ def new_constants_in(*descs)
# 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 @@ def new_constants_in(*descs)
# 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 @@ def remove_constant(const) #: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}"

0 comments on commit cecac31

Please sign in to comment.