module Commutator::Model::Hooks::ClassMethods

Public Instance Methods

add_before_hook(operation, *method_names) click to toggle source
# File lib/commutator/model/hooks.rb, line 21
def add_before_hook(operation, *method_names)
  method_names.each do |method_name|
    before_hooks[operation] << method_name
  end
end
before_hooks() click to toggle source
# File lib/commutator/model/hooks.rb, line 27
def before_hooks
  @before_hooks ||= Hash.new { |h, k| h[k] = [] }
end
run_before_hooks(operation, options) click to toggle source
# File lib/commutator/model/hooks.rb, line 31
def run_before_hooks(operation, options)
  before_hooks[operation].each do |method_name|
    send(method_name, options)
  end

  options
end