Module: Isolator::Callbacks

Included in:
Isolator
Defined in:
lib/isolator/callbacks.rb

Overview

Add before_isolate and after_isolate callbacks

Instance Method Summary collapse

Instance Method Details

#after_isolate(&block) ⇒ Object



10
11
12
# File 'lib/isolator/callbacks.rb', line 10

def after_isolate(&block)
  after_isolate_callbacks << block
end

#after_isolate_callbacksObject



28
29
30
# File 'lib/isolator/callbacks.rb', line 28

def after_isolate_callbacks
  @after_isolate_callbacks ||= []
end

#before_isolate(&block) ⇒ Object



6
7
8
# File 'lib/isolator/callbacks.rb', line 6

def before_isolate(&block)
  before_isolate_callbacks << block
end

#before_isolate_callbacksObject



24
25
26
# File 'lib/isolator/callbacks.rb', line 24

def before_isolate_callbacks
  @before_isolate_callbacks ||= []
end

#finish!Object



19
20
21
22
# File 'lib/isolator/callbacks.rb', line 19

def finish!
  return if Isolator.disabled?
  after_isolate_callbacks.each(&:call)
end

#start!Object



14
15
16
17
# File 'lib/isolator/callbacks.rb', line 14

def start!
  return if Isolator.disabled?
  before_isolate_callbacks.each(&:call)
end