diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-18 17:02:25 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-18 17:02:25 -0500 |
commit | 7193f750ffe0276a16b3703f4cf05e7b36e7df7b (patch) | |
tree | decf894aea38978d7b68cf3241545272a2da4bbf | |
parent | 99e33c03b7ccad3254c787a19bc7082e23dbcd27 (diff) | |
download | rails-7193f750ffe0276a16b3703f4cf05e7b36e7df7b.tar.gz rails-7193f750ffe0276a16b3703f4cf05e7b36e7df7b.tar.bz2 rails-7193f750ffe0276a16b3703f4cf05e7b36e7df7b.zip |
Rename @locals to @_locals in Thread to avoid conflict with Rubinius. Closes #11831
-rw-r--r-- | activesupport/lib/active_support/core_ext/thread.rb | 14 |
1 files changed, 7 insertions, 7 deletions
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 <tt>true</tt> 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) |