Class: Lotus::Routing::EndpointResolver Private
- Inherits:
-
Object
- Object
- Lotus::Routing::EndpointResolver
- Defined in:
- lib/lotus/routing/endpoint_resolver.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Resolve duck-typed endpoints
Constant Summary collapse
- NAMING_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%{controller}::%{action}'.freeze
- ACTION_SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default separator for controller and action. A different separator can be passed to #initialize with the ‘:separator` option.
'#'.freeze
Instance Attribute Summary collapse
- #action_separator ⇒ Object readonly private
Instance Method Summary collapse
-
#find(options) ⇒ Object
private
Finds a path from the given options.
-
#initialize(options = {}) ⇒ Lotus::Routing::EndpointResolver
constructor
private
Initialize an endpoint resolver.
-
#resolve(options, &endpoint) ⇒ Endpoint
private
Resolve the given set of HTTP verb, path, endpoint and options.
Constructor Details
#initialize(options = {}) ⇒ Lotus::Routing::EndpointResolver
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an endpoint resolver
96 97 98 99 100 101 |
# File 'lib/lotus/routing/endpoint_resolver.rb', line 96 def initialize( = {}) @endpoint_class = [:endpoint] || Endpoint @namespace = [:namespace] || Object @action_separator = [:action_separator] || ACTION_SEPARATOR @pattern = [:pattern] || NAMING_PATTERN end |
Instance Attribute Details
#action_separator ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/lotus/routing/endpoint_resolver.rb', line 33 def action_separator @action_separator end |
Instance Method Details
#find(options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Finds a path from the given options.
174 175 176 |
# File 'lib/lotus/routing/endpoint_resolver.rb', line 174 def find() [:to] end |
#resolve(options, &endpoint) ⇒ Endpoint
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve the given set of HTTP verb, path, endpoint and options. If it fails to resolve, it will mount the default endpoint to the given path, which returns an 404 (Not Found).
160 161 162 163 |
# File 'lib/lotus/routing/endpoint_resolver.rb', line 160 def resolve(, &endpoint) result = endpoint || find() resolve_callable(result) || resolve_matchable(result) || default end |