Module: ActiveSupport::IsolatedExecutionState

Defined in:
activesupport/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



13
14
15
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 13

def isolation_level
  @isolation_level
end

.scopeObject (readonly)

Returns the value of attribute scope



13
14
15
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 13

def scope
  @scope
end

Instance Attribute Details

#active_support_execution_stateObject

Returns the value of attribute active_support_execution_state



9
10
11
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 9

def active_support_execution_state
  @active_support_execution_state
end

Class Method Details

.[](key) ⇒ Object



37
38
39
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 37

def [](key)
  state[key]
end

.[]=(key, value) ⇒ Object



41
42
43
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 41

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

.clearObject



53
54
55
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 53

def clear
  state.clear
end

.contextObject



57
58
59
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 57

def context
  scope.current
end

.delete(key) ⇒ Object



49
50
51
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 49

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

.key?(key) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 45

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

.share_with(other) ⇒ Object



61
62
63
64
65
66
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 61

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



33
34
35
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 33

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