Module: Axn::Core::NestingTracking

Defined in:
lib/axn/core/nesting_tracking.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

._current_axn_stackObject

Shared method for both class and instance access



19
20
21
# File 'lib/axn/core/nesting_tracking.rb', line 19

def self._current_axn_stack
  ActiveSupport::IsolatedExecutionState[:_axn_stack] ||= []
end

.included(base) ⇒ Object



6
7
8
9
10
# File 'lib/axn/core/nesting_tracking.rb', line 6

def self.included(base)
  base.class_eval do
    extend ClassMethods
  end
end

.tracking(axn) ⇒ Object

Tracks nesting of axn calls for logging/debugging purposes



24
25
26
27
28
29
# File 'lib/axn/core/nesting_tracking.rb', line 24

def self.tracking(axn)
  _current_axn_stack.push(axn)
  yield
ensure
  _current_axn_stack.pop
end