Module: Txnap::ExecutionState
- Defined in:
- lib/txnap/execution_state.rb
Constant Summary collapse
- KEY =
:txnap_suppression_depth
Class Method Summary collapse
Class Method Details
.state ⇒ Object
24 25 26 |
# File 'lib/txnap/execution_state.rb', line 24 def state ActiveSupport::IsolatedExecutionState end |
.suppress ⇒ Object
9 10 11 12 13 14 |
# File 'lib/txnap/execution_state.rb', line 9 def suppress state[KEY] = suppression_depth + 1 yield ensure state[KEY] = [suppression_depth - 1, 0].max end |
.suppressed? ⇒ Boolean
16 17 18 |
# File 'lib/txnap/execution_state.rb', line 16 def suppressed? suppression_depth.positive? end |
.suppression_depth ⇒ Object
20 21 22 |
# File 'lib/txnap/execution_state.rb', line 20 def suppression_depth state[KEY] || 0 end |