Module: ActiveSupport::IsolatedExecutionState

Defined in:
lib/active_support/isolated_execution_state.rb

Overview

:nodoc:

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.isolation_levelObject

Returns the value of attribute isolation_level.



11
12
13
# File 'lib/active_support/isolated_execution_state.rb', line 11

def isolation_level
  @isolation_level
end

.scopeObject (readonly)

Returns the value of attribute scope.



11
12
13
# File 'lib/active_support/isolated_execution_state.rb', line 11

def scope
  @scope
end

Instance Attribute Details

#active_support_execution_stateObject

Returns the value of attribute active_support_execution_state.



7
8
9
# File 'lib/active_support/isolated_execution_state.rb', line 7

def active_support_execution_state
  @active_support_execution_state
end

Class Method Details

.[](key) ⇒ Object



35
36
37
# File 'lib/active_support/isolated_execution_state.rb', line 35

def [](key)
  state[key]
end

.[]=(key, value) ⇒ Object



39
40
41
# File 'lib/active_support/isolated_execution_state.rb', line 39

def []=(key, value)
  state[key] = value
end

.clearObject



51
52
53
# File 'lib/active_support/isolated_execution_state.rb', line 51

def clear
  state.clear
end

.contextObject



55
56
57
# File 'lib/active_support/isolated_execution_state.rb', line 55

def context
  scope.current
end

.delete(key) ⇒ Object



47
48
49
# File 'lib/active_support/isolated_execution_state.rb', line 47

def delete(key)
  state.delete(key)
end

.key?(key) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/active_support/isolated_execution_state.rb', line 43

def key?(key)
  state.key?(key)
end

.share_with(other) ⇒ Object



59
60
61
62
63
64
# File 'lib/active_support/isolated_execution_state.rb', line 59

def share_with(other)
  # Action Controller streaming spawns a new thread and copy thread locals.
  # We do the same here for backward compatibility, but this is very much a hack
  # and streaming should be rethought.
  context.active_support_execution_state = other.active_support_execution_state.dup
end

.unique_idObject



31
32
33
# File 'lib/active_support/isolated_execution_state.rb', line 31

def unique_id
  self[:__id__] ||= Object.new
end