From 7193f750ffe0276a16b3703f4cf05e7b36e7df7b Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Sun, 18 Aug 2013 17:02:25 -0500 Subject: Rename @locals to @_locals in Thread to avoid conflict with Rubinius. Closes #11831 --- activesupport/lib/active_support/core_ext/thread.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/thread.rb b/activesupport/lib/active_support/core_ext/thread.rb index 5481766f10..de752f14ef 100644 --- a/activesupport/lib/active_support/core_ext/thread.rb +++ b/activesupport/lib/active_support/core_ext/thread.rb @@ -23,14 +23,14 @@ class Thread # for the fiber local. The fiber is executed in the same thread, so the # thread local values are available. def thread_variable_get(key) - locals[key.to_sym] + _locals[key.to_sym] end # Sets a thread local with +key+ to +value+. Note that these are local to # threads, and not to fibers. Please see Thread#thread_variable_get for # more information. def thread_variable_set(key, value) - locals[key.to_sym] = value + _locals[key.to_sym] = value end # Returns an an array of the names of the thread-local variables (as Symbols). @@ -45,7 +45,7 @@ class Thread # Note that these are not fiber local variables. Please see Thread#thread_variable_get # for more details. def thread_variables - locals.keys + _locals.keys end # Returns true if the given string (or symbol) exists as a @@ -59,16 +59,16 @@ class Thread # Note that these are not fiber local variables. Please see Thread#thread_variable_get # for more details. def thread_variable?(key) - locals.has_key?(key.to_sym) + _locals.has_key?(key.to_sym) end private - def locals + def _locals if defined?(@locals) - @locals + @_locals else - LOCK.synchronize { @locals ||= {} } + LOCK.synchronize { @_locals ||= {} } end end end unless Thread.instance_methods.include?(:thread_variable_set) -- cgit v1.2.3