mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Ruby 1.9 compat: dependencies uses Module#local_constant_names. References #1689 [Frederick Cheung]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8482 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
8b5f4e474f
commit
c64a29f6f1
2 changed files with 9 additions and 3 deletions
|
@ -32,4 +32,10 @@ class Module
|
||||||
! inherited.key?(const) || inherited[const].object_id != const_get(const).object_id
|
! inherited.key?(const) || inherited[const].object_id != const_get(const).object_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the names of the constants defined locally rather than the
|
||||||
|
# constants themselves. See <tt>local_constants</tt>.
|
||||||
|
def local_constant_names
|
||||||
|
local_constants.map(&:to_s)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -318,13 +318,13 @@ module Dependencies #:nodoc:
|
||||||
watch_frames = descs.collect do |desc|
|
watch_frames = descs.collect do |desc|
|
||||||
if desc.is_a? Module
|
if desc.is_a? Module
|
||||||
mod_name = desc.name
|
mod_name = desc.name
|
||||||
initial_constants = desc.local_constants
|
initial_constants = desc.local_constant_names
|
||||||
elsif desc.is_a?(String) || desc.is_a?(Symbol)
|
elsif desc.is_a?(String) || desc.is_a?(Symbol)
|
||||||
mod_name = desc.to_s
|
mod_name = desc.to_s
|
||||||
|
|
||||||
# Handle the case where the module has yet to be defined.
|
# Handle the case where the module has yet to be defined.
|
||||||
initial_constants = if qualified_const_defined?(mod_name)
|
initial_constants = if qualified_const_defined?(mod_name)
|
||||||
mod_name.constantize.local_constants
|
mod_name.constantize.local_constant_names
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
@ -349,7 +349,7 @@ module Dependencies #:nodoc:
|
||||||
|
|
||||||
mod = mod_name.constantize
|
mod = mod_name.constantize
|
||||||
next [] unless mod.is_a? Module
|
next [] unless mod.is_a? Module
|
||||||
new_constants = mod.local_constants - prior_constants
|
new_constants = mod.local_constant_names - prior_constants
|
||||||
|
|
||||||
# Make sure no other frames takes credit for these constants.
|
# Make sure no other frames takes credit for these constants.
|
||||||
constant_watch_stack.each do |frame_name, constants|
|
constant_watch_stack.each do |frame_name, constants|
|
||||||
|
|
Loading…
Reference in a new issue