Class: Deas::Route
- Inherits:
-
Object
- Object
- Deas::Route
- Defined in:
- lib/deas/route.rb
Instance Attribute Summary collapse
-
#handler_proxies ⇒ Object
readonly
Returns the value of attribute handler_proxies.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(method, path, handler_proxies) ⇒ Route
constructor
A new instance of Route.
- #run(sinatra_call) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(method, path, handler_proxies) ⇒ Route
Returns a new instance of Route.
9 10 11 |
# File 'lib/deas/route.rb', line 9 def initialize(method, path, handler_proxies) @method, @path, @handler_proxies = method, path, handler_proxies end |
Instance Attribute Details
#handler_proxies ⇒ Object (readonly)
Returns the value of attribute handler_proxies.
7 8 9 |
# File 'lib/deas/route.rb', line 7 def handler_proxies @handler_proxies end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/deas/route.rb', line 7 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/deas/route.rb', line 7 def path @path end |
Instance Method Details
#run(sinatra_call) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/deas/route.rb', line 19 def run(sinatra_call) type = sinatra_call.settings.router.request_type_name(sinatra_call.request) proxy = begin @handler_proxies[type] rescue HandlerProxyNotFound sinatra_call.halt(404) end proxy.run(sinatra_call) end |
#validate! ⇒ Object
13 14 15 16 17 |
# File 'lib/deas/route.rb', line 13 def validate! @handler_proxies.each do |request_type_name, proxy| proxy.validate! end end |