Class: Torikago::ControllerEndpoint
- Inherits:
-
Object
- Object
- Torikago::ControllerEndpoint
- Defined in:
- lib/torikago/controller_endpoint.rb,
sig/torikago.rbs
Overview
A host-owned Rack-compatible route endpoint that dispatches directly to a controller class loaded inside a registered module runtime. It is not Rack middleware. The host router never resolves the controller constant, so Rails::Engine is not required for isolation.
Instance Attribute Summary collapse
-
#action_name ⇒ Symbol
readonly
Returns the value of attribute action_name.
-
#controller_name ⇒ String
readonly
Returns the value of attribute controller_name.
-
#module_name ⇒ Symbol
readonly
Returns the value of attribute module_name.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(module_name, controller_name, action_name, registry: nil) ⇒ ControllerEndpoint
constructor
A new instance of ControllerEndpoint.
- #registry ⇒ Registry
Constructor Details
#initialize(module_name, controller_name, action_name, registry: nil) ⇒ ControllerEndpoint
Returns a new instance of ControllerEndpoint.
7 8 9 10 11 12 |
# File 'lib/torikago/controller_endpoint.rb', line 7 def initialize(module_name, controller_name, action_name, registry: nil) @module_name = module_name.to_sym @controller_name = controller_name.to_s @action_name = action_name.to_sym @registry = registry end |
Instance Attribute Details
#action_name ⇒ Symbol (readonly)
Returns the value of attribute action_name.
24 25 26 |
# File 'lib/torikago/controller_endpoint.rb', line 24 def action_name @action_name end |
#controller_name ⇒ String (readonly)
Returns the value of attribute controller_name.
24 25 26 |
# File 'lib/torikago/controller_endpoint.rb', line 24 def controller_name @controller_name end |
#module_name ⇒ Symbol (readonly)
Returns the value of attribute module_name.
24 25 26 |
# File 'lib/torikago/controller_endpoint.rb', line 24 def module_name @module_name end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/torikago/controller_endpoint.rb', line 14 def call(env) registry.resolve(module_name).dispatch_controller( env, controller_name: controller_name, action_name: action_name ) end |