Module: ActiveSupport::ExecutionContext
    Do not use.  This module is for internal use only.
  
| Relationships & Source Files | |
| Namespace Children | |
| 
       Modules: 
      
     | |
| 
       Classes: 
      
     | |
| Defined in: | activesupport/lib/active_support/execution_context.rb | 
Class Attribute Summary
- .nestable rw
 
Class Method Summary
- .[]=(key, value)
 - .after_change(&block)
 - .clear
 - .current_attributes_instances
 - .pop
 - .push
 - 
    
      .set(**options)  
    
    
Updates the execution context.
 - .to_h
 - .record private
 
Class Attribute Details
.nestable (rw)
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 38
attr_accessor :nestable
Class Method Details
.[]=(key, value)
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 69
def []=(key, value) record.store[key.to_sym] = value @after_change_callbacks.each(&:call) end
.after_change(&block)
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 40
def after_change(&block) @after_change_callbacks << block end
.clear
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 96
def clear IsolatedExecutionState[:active_support_execution_context] = nil end
.current_attributes_instances
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 100
def current_attributes_instances record.current_attributes_instances end
.pop
[ GitHub ].push
[ GitHub ].record (private)
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 105
def record IsolatedExecutionState[:active_support_execution_context] ||= Record.new end
.set(**options)
Updates the execution context. If a block is given, it resets the provided keys to their previous value once the block exits.
# File 'activesupport/lib/active_support/execution_context.rb', line 46
def set(**) .symbolize_keys! keys = .keys store = record.store previous_context = if block_given? keys.zip(store.values_at(*keys)).to_h end store.merge!() @after_change_callbacks.each(&:call) if block_given? begin yield ensure store.merge!(previous_context) @after_change_callbacks.each(&:call) end end end
.to_h
[ GitHub ]# File 'activesupport/lib/active_support/execution_context.rb', line 74
def to_h record.store.dup end