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(server_data, request_data) ⇒ 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(server_data, request_data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/deas/route.rb', line 19 def run(server_data, request_data) server_data.before_route_run_procs.each do |c| c.call(server_data, request_data) end request_type_name = server_data.router.request_type_name(request_data.request) begin @handler_proxies[request_type_name].run(server_data, request_data) rescue HandlerProxyNotFound [404, Rack::Utils::HeaderHash.new, []] ensure server_data.after_route_run_procs.each do |c| c.call(server_data, request_data) end end 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 |