Class: Gaffe::ErrorsControllerResolver
- Inherits:
-
Object
- Object
- Gaffe::ErrorsControllerResolver
- Defined in:
- lib/gaffe/errors_controller_resolver.rb
Constant Summary collapse
- BUILTIN_CONTROLLER =
Constants
lambda do require 'gaffe/errors_controller' Gaffe::ErrorsController end
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Accessors.
Instance Method Summary collapse
-
#initialize(env) ⇒ ErrorsControllerResolver
constructor
A new instance of ErrorsControllerResolver.
- #resolved_controller ⇒ Object
Constructor Details
#initialize(env) ⇒ ErrorsControllerResolver
Returns a new instance of ErrorsControllerResolver.
12 13 14 |
# File 'lib/gaffe/errors_controller_resolver.rb', line 12 def initialize(env) @env = env end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Accessors
4 5 6 |
# File 'lib/gaffe/errors_controller_resolver.rb', line 4 def controller @controller end |
Instance Method Details
#resolved_controller ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gaffe/errors_controller_resolver.rb', line 16 def resolved_controller # Use the configured controller first controller = Gaffe.configuration.errors_controller # Parse the request if multiple controllers are configured controller = request_controller(controller) if controller.is_a?(Hash) # Fall back on the builtin errors controller controller ||= BUILTIN_CONTROLLER.call # Make sure we return a Class controller.respond_to?(:constantize) ? controller.constantize : controller end |