Module: Light::Services::Callbacks::ClassMethods

Defined in:
lib/light/services/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#after(method) ⇒ Object



30
31
32
# File 'lib/light/services/callbacks.rb', line 30

def after(method)
  set_callback(:after, method)
end

#before(method) ⇒ Object



26
27
28
# File 'lib/light/services/callbacks.rb', line 26

def before(method)
  set_callback(:before, method)
end

#finally(method) ⇒ Object



34
35
36
# File 'lib/light/services/callbacks.rb', line 34

def finally(method)
  set_callback(:finally, method)
end

#set_callback(type, method) ⇒ Object



38
39
40
41
# File 'lib/light/services/callbacks.rb', line 38

def set_callback(type, method)
  self.callbacks ||= []
  self.callbacks << { type: type, method: method }
end