Class: Signpost::Endpoint::Resolver
- Inherits:
-
Object
- Object
- Signpost::Endpoint::Resolver
- Defined in:
- lib/signpost/endpoint/resolver.rb
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#resolve ⇒ Object
Resolve endpoint and params.
Instance Method Details
#resolve ⇒ Object
Resolve endpoint and params
Returns: Result
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/signpost/endpoint/resolver.rb', line 19 def resolve case spec when Hash params = resolve_hash(spec[:controller], spec[:action]) when String params = resolve_string else endpoint = spec params = {} end unless endpoint if params[:action].kind_of?(Class) endpoint = params[:action] elsif params[:controller] endpoint = params[:controller] else if params[:action] # Try namespace as endpoint # this must be refactored in new year if [:namespace] specc = { action: params[:action], controller: [:namespace] } opts = .dup opts.delete(:namespace) result = self.class.new(specc, opts).resolve return result if result end end endpoint = Dynamic.new(, params) end end Result.new(endpoint, params) end |