Module: PoolLint::ExecutionState

Defined in:
lib/poollint/execution_state.rb

Constant Summary collapse

KEY =
:poollint_inspecting
SUPPRESSION_KEY =
:poollint_suppressed

Class Method Summary collapse

Class Method Details

.inspecting?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/poollint/execution_state.rb', line 12

def inspecting?
  ActiveSupport::IsolatedExecutionState[KEY] == true
end

.suppressObject



28
29
30
31
32
33
34
# File 'lib/poollint/execution_state.rb', line 28

def suppress
  previous = ActiveSupport::IsolatedExecutionState[SUPPRESSION_KEY]
  ActiveSupport::IsolatedExecutionState[SUPPRESSION_KEY] = true
  yield
ensure
  ActiveSupport::IsolatedExecutionState[SUPPRESSION_KEY] = previous
end

.suppressed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/poollint/execution_state.rb', line 24

def suppressed?
  ActiveSupport::IsolatedExecutionState[SUPPRESSION_KEY] == true
end

.while_inspectingObject



16
17
18
19
20
21
22
# File 'lib/poollint/execution_state.rb', line 16

def while_inspecting
  previous = ActiveSupport::IsolatedExecutionState[KEY]
  ActiveSupport::IsolatedExecutionState[KEY] = true
  yield
ensure
  ActiveSupport::IsolatedExecutionState[KEY] = previous
end