Module: MARS::Hooks

Included in:
Runnable
Defined in:
lib/mars/hooks.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/mars/hooks.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#run_after_hooks(context, result) ⇒ Object



31
32
33
# File 'lib/mars/hooks.rb', line 31

def run_after_hooks(context, result)
  self.class.after_run_hooks.each { |hook| hook.call(context, result, self) }
end

#run_before_hooks(context) ⇒ Object



27
28
29
# File 'lib/mars/hooks.rb', line 27

def run_before_hooks(context)
  self.class.before_run_hooks.each { |hook| hook.call(context, self) }
end