Module: RaceGuard::DetectorRuntime

Defined in:
lib/race_guard/detector_runtime.rb

Overview

Hooks invoked around protect blocks. Register detectors on Configuration via #add_protect_detector; default list is empty.

Class Method Summary collapse

Class Method Details

.enter(name) ⇒ Object



11
12
13
14
15
16
# File 'lib/race_guard/detector_runtime.rb', line 11

def enter(name)
  RaceGuard.configuration.protect_detectors.each do |detector|
    detector.on_protect_enter(name) if detector.respond_to?(:on_protect_enter)
  end
  RuleEngine.dispatch(:protect_enter, protect: name)
end

.exit(name) ⇒ Object



18
19
20
21
22
23
# File 'lib/race_guard/detector_runtime.rb', line 18

def exit(name)
  RaceGuard.configuration.protect_detectors.each do |detector|
    detector.on_protect_exit(name) if detector.respond_to?(:on_protect_exit)
  end
  RuleEngine.dispatch(:protect_exit, protect: name)
end