module Interaptor::Callbacks

Public Class Methods

included(base) click to toggle source
# File lib/interaptor/callbacks.rb, line 5
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

run_after_callbacks() click to toggle source
# File lib/interaptor/callbacks.rb, line 20
def run_after_callbacks
  self.class.after_callbacks.each { |callback| run_callback(callback) }
end
run_before_callbacks() click to toggle source
# File lib/interaptor/callbacks.rb, line 16
def run_before_callbacks
  self.class.before_callbacks.each { |callback| run_callback(callback) }
end
run_callback(callback, *args) click to toggle source
# File lib/interaptor/callbacks.rb, line 9
def run_callback(callback, *args)
  if callback.is_a?(Symbol)
  else
    instance_exec(*args, &callback)
  end
end