Compare commits

...

6 Commits

Author SHA1 Message Date
Charlie Somerville
c0124ba8f3 bump RAILS_VERSION 2013-12-02 20:43:27 +11:00
Charlie Somerville
455cd8c060 Merge pull request #28 from github/dont-turn-constant-names-into-strings
Don't turn constant names into strings prematurely
2013-12-02 01:27:18 -08:00
Charlie Somerville
5d322ad957 delete Module#local_constant_names 2013-12-02 20:09:05 +11:00
Charlie Somerville
3b6b4578c4 don't return anything interesting from require or load_with_new_constant_marking 2013-12-02 19:51:45 +11:00
Charlie Somerville
981016be60 call local_constants instead of local_constant_names 2013-12-02 19:40:28 +11:00
Aman Gupta
3c1e01068b faster String#blank? regex 2013-11-21 13:53:47 -08:00
4 changed files with 10 additions and 12 deletions

View File

@@ -1 +1 @@
2.3.14.github30
2.3.14.github31

View File

@@ -79,12 +79,6 @@ module ActiveSupport
constants(false)
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 { |c| c.to_s }
end
end
end
end

View File

@@ -82,7 +82,7 @@ class String
# 1.8 does not takes [:space:] properly
if encoding_aware?
self !~ /[^[:space:]]/
self =~ /\A[[:space:]]*\z/
else
self !~ NON_WHITESPACE_REGEXP
end

View File

@@ -172,6 +172,7 @@ module ActiveSupport #:nodoc:
else
load_without_new_constant_marking(file, *extras)
end
nil
rescue Exception => exception # errors from loading file
exception.blame_file! file
raise
@@ -180,6 +181,7 @@ module ActiveSupport #:nodoc:
def require(file, *extras) #:nodoc:
if Dependencies.load?
Dependencies.new_constants_in(Object) { super }
true
else
super
end
@@ -521,13 +523,13 @@ module ActiveSupport #:nodoc:
watch_frames = descs.collect do |desc|
if desc.is_a? Module
mod_name = desc.name
initial_constants = desc.local_constant_names
initial_constants = desc.local_constants
elsif desc.is_a?(String) || desc.is_a?(Symbol)
mod_name = desc.to_s
# 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
mod_name.constantize.local_constants
else
[]
end
@@ -554,7 +556,7 @@ module ActiveSupport #:nodoc:
mod = mod_name.constantize
next [] unless mod.is_a? Module
new_constants = mod.local_constant_names - prior_constants
new_constants = mod.local_constants - prior_constants
# Make sure no other frames takes credit for these constants.
constant_watch_stack_mutex.synchronize do
@@ -577,7 +579,9 @@ module ActiveSupport #:nodoc:
end
end
return new_constants
# XXX trace callers to this method and make them expect an array of
# symbols instead of strings and remove this to_s - charliesome
return new_constants.map(&:to_s)
ensure
# Remove the stack frames that we added.
if defined?(watch_frames) && ! watch_frames.blank?