Method: ActiveSupport::Rescuable::ClassMethods#handler_for_rescue
- Defined in:
- lib/active_support/rescuable.rb
#handler_for_rescue(exception, object: self) ⇒ Object
:nodoc:
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/active_support/rescuable.rb', line 105 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 |