Method: Asset::Router#call!
- Defined in:
- lib/assets/router.rb
#call!(env) ⇒ Object
Call
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 |
# File 'lib/assets/router.rb', line 20 def call!(env) # Setting up request @request = ::Rack::Request.new(env) # The routes case @request.path_info # Match /assets?/:type/path when /^(\/assets)?\/(js|css)\/(.+)/ # Extract type and path type, path = $2, $3 # Extract digest key and remove from path path.gsub!("-#{@key = $1}", '') if path =~ /-([a-f0-9]{32})\.(css|js)$/ # Find the item item = ::Asset.manifest.find{|i| i.path == path and i.type == type} # Return the content or not found item ? found(item) : not_found # Bounce favicon requests when (::Asset.favicon and /^\/favicon\.ico$/) not_found # Return a standard robots.txt when (::Asset.robots and /^\/robots\.txt$/) robots else # No routes found, pass down the middleware stack @app.call(env) end end |