Module: ActiveSupport::IsolatedExecutionState
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | activesupport/lib/active_support/isolated_execution_state.rb |
Class Attribute Summary
- .isolation_level rw
- .isolation_level=(level) rw
- .scope readonly
Class Method Summary
Instance Attribute Summary
Class Attribute Details
.isolation_level (rw)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 11
attr_reader :isolation_level, :scope
.isolation_level=(level) (rw)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 13
def isolation_level=(level) return if level == @isolation_level unless %i(thread fiber).include?(level) raise ArgumentError, "isolation_level must be `:thread` or `:fiber`, got: `#{level.inspect}`" end clear if @isolation_level @scope = case level when :thread; Thread when :fiber; Fiber end @isolation_level = level end
.scope (readonly)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 11
attr_reader :isolation_level, :scope
Class Method Details
.[](key)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 35
def [](key) state[key] end
.[]=(key, value)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 39
def []=(key, value) state[key] = value end
.clear
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 51
def clear state.clear end
.context
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 55
def context scope.current end
.delete(key)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 47
def delete(key) state.delete(key) end
.key?(key) ⇒ Boolean
# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 43
def key?(key) state.key?(key) end
.state (private)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 67
def state context.active_support_execution_state ||= {} end
.unique_id
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 31
def unique_id self[:__id__] ||= Object.new end
Instance Attribute Details
#active_support_execution_state (rw)
[ GitHub ]# File 'activesupport/lib/active_support/isolated_execution_state.rb', line 7
Thread.attr_accessor :active_support_execution_state