Method: Junkfood::Rack::ChainedRouter#call
- Defined in:
- lib/junkfood/rack/chained_router.rb
#call(env) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/junkfood/rack/chained_router.rb', line 101 def call(env) # Set some defaults if the route set is empty. results = [ HTTP_NOT_FOUND, { X_CASCADE => PASS, CONTENT_TYPE => 'text/plain' }, []] # Call each link in chain. for link in @chain results = link.call env return results unless results[1][X_CASCADE] == PASS end # Return the results of the last link in chain, or the originally # set results if chain is empty. return results end |