Module: BootyCall::Callbacker::ClassMethods
- Defined in:
- lib/booty_call/callbacker.rb
Instance Method Summary collapse
Instance Method Details
#run_callbacks_for(target, position, method_id, *results) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/booty_call/callbacker.rb', line 62 def run_callbacks_for(target, position, method_id, *results) callbacks = callback_cache[position][method_id.to_sym] handler = proc do |fn| fn.is_a?(Proc) ? fn : begin target.method(fn).arity.abs == results.length ? proc { send(fn, *results) } : proc { send(fn) } end end callbacks.empty? ? true : callbacks.map { |fn| target.instance_exec(*results, &handler.call(fn)) }.all? end |