module ActiveSupport::Rescuable::ClassMethods

def handler_for_rescue(exception, object: self) #:nodoc:

:nodoc:
def handler_for_rescue(exception, object: self) #:nodoc:
  case rescuer = find_rescue_handler(exception)
  when Symbol
    method = object.method(rescuer)
    if method.arity == 0
      -> e { method.call }
    else
      method
    end
  when Proc
    if rescuer.arity == 0
      -> e { object.instance_exec(&rescuer) }
    else
      -> e { object.instance_exec(e, &rescuer) }
    end
  end
end