Class: Otto::ResponseHandlers::RedirectHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Otto::ResponseHandlers::RedirectHandler
- Defined in:
- lib/otto/response_handlers/redirect.rb
Overview
Handler for redirect responses
Class Method Summary collapse
Methods inherited from BaseHandler
Class Method Details
.handle(result, response, context = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/otto/response_handlers/redirect.rb', line 11 def self.handle(result, response, context = {}) # Determine redirect path path = if context[:redirect_path] context[:redirect_path] elsif context[:logic_instance]&.respond_to?(:redirect_path) context[:logic_instance].redirect_path elsif result.is_a?(String) result else '/' end response.redirect(path) end |