Module: Godwit::Callbacks

Defined in:
lib/godwit/callbacks.rb

Overview

Callbacks for before and after run.

Constant Summary collapse

CALLBACKS =
%w(before_run after_run)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/godwit/callbacks.rb', line 8

def self.included(base)
  base.send :alias_method_chain, :run, :callbacks
  base.send :include, ActiveSupport::Callbacks
  base.define_callbacks *CALLBACKS
end

Instance Method Details

#after_runObject

This is called after everything else finishes.



19
# File 'lib/godwit/callbacks.rb', line 19

def after_run() end

#before_runObject

This is called before you anything actually starts.



16
# File 'lib/godwit/callbacks.rb', line 16

def before_run() end

#run_with_callbacksObject

:nodoc:



20
21
22
23
24
# File 'lib/godwit/callbacks.rb', line 20

def run_with_callbacks #:nodoc:
  callback(:before_run)
  run_without_callbacks
  callback(:after_run)
end