Module: ActiveSupport::IsolatedExecutionState
- Defined in:
- lib/active_support/isolated_execution_state.rb
Overview
:nodoc:
Class Attribute Summary collapse
-
.isolation_level ⇒ Object
Returns the value of attribute isolation_level.
Instance Attribute Summary collapse
-
#active_support_execution_state ⇒ Object
Returns the value of attribute active_support_execution_state.
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .clear ⇒ Object
- .delete(key) ⇒ Object
- .key?(key) ⇒ Boolean
- .share_with(other) ⇒ Object
- .unique_id ⇒ Object
Class Attribute Details
.isolation_level ⇒ Object
Returns the value of attribute isolation_level.
13 14 15 |
# File 'lib/active_support/isolated_execution_state.rb', line 13 def isolation_level @isolation_level end |
Instance Attribute Details
#active_support_execution_state ⇒ Object
Returns the value of attribute active_support_execution_state.
9 10 11 |
# File 'lib/active_support/isolated_execution_state.rb', line 9 def active_support_execution_state @active_support_execution_state end |
Class Method Details
.[](key) ⇒ Object
32 33 34 |
# File 'lib/active_support/isolated_execution_state.rb', line 32 def [](key) current[key] end |
.[]=(key, value) ⇒ Object
36 37 38 |
# File 'lib/active_support/isolated_execution_state.rb', line 36 def []=(key, value) current[key] = value end |
.clear ⇒ Object
48 49 50 |
# File 'lib/active_support/isolated_execution_state.rb', line 48 def clear current.clear end |
.delete(key) ⇒ Object
44 45 46 |
# File 'lib/active_support/isolated_execution_state.rb', line 44 def delete(key) current.delete(key) end |
.key?(key) ⇒ Boolean
40 41 42 |
# File 'lib/active_support/isolated_execution_state.rb', line 40 def key?(key) current.key?(key) end |
.share_with(other) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/active_support/isolated_execution_state.rb', line 52 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 = @isolation_level == :thread ? Thread.current : Fiber.current context.active_support_execution_state = other.active_support_execution_state.dup end |