class Thread

Constants

INHERITABLE_ATTRIBUTES_MUTEX

Public Class Methods

new(*args, &block) click to toggle source
# File lib/thread/inheritable_attributes.rb, line 8
def initialize(*args, &block)
  _inheritable_attributes = inheritable_attributes.dup
  _initialize(*args) do |*block_args|
    store[:inheritable_attributes] = _inheritable_attributes
    block.call(block_args)
  end
end
Also aliased as: _initialize

Public Instance Methods

_initialize(*args, &block)
Alias for: new
get_inheritable_attribute(key) click to toggle source
# File lib/thread/inheritable_attributes.rb, line 16
def get_inheritable_attribute(key)
  INHERITABLE_ATTRIBUTES_MUTEX.synchronize do
    inheritable_attributes[key]
  end
end
set_inheritable_attribute(key, value) click to toggle source
# File lib/thread/inheritable_attributes.rb, line 22
def set_inheritable_attribute(key, value)
  INHERITABLE_ATTRIBUTES_MUTEX.synchronize do
    inheritable_attributes[key] = value
  end
end

Protected Instance Methods

inheritable_attributes() click to toggle source
# File lib/thread/inheritable_attributes.rb, line 30
def inheritable_attributes
  store[:inheritable_attributes] ||= {}
end
store() click to toggle source
# File lib/thread/inheritable_attributes.rb, line 34
def store
  RequestStore.store
end