instance method
thread_variable?
Ruby on Rails 4.1.16
Since v4.0.13 Last seen in v4.2.9Signature
thread_variable?(key)
Returns true if the given string (or symbol) exists as a thread-local variable.
me = Thread.current me.thread_variable_set(:oliver, "a") me.thread_variable?(:oliver) # => true me.thread_variable?(:stanley) # => false
Note that these are not fiber local variables. Please see Thread#thread_variable_get for more details.
Parameters
-
keyreq
Source
# File activesupport/lib/active_support/core_ext/thread.rb, line 61
def thread_variable?(key)
_locals.has_key?(key.to_sym)
end
Defined in activesupport/lib/active_support/core_ext/thread.rb line 61
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Thread