Class: Hanami::Assets::Middleware
- Inherits:
-
Object
- Object
- Hanami::Assets::Middleware
- Defined in:
- lib/hanami/sprockets/middleware.rb
Overview
Rack middleware for serving assets in development
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(app, assets) ⇒ Middleware
constructor
private
A new instance of Middleware.
Constructor Details
#initialize(app, assets) ⇒ Middleware
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Middleware.
12 13 14 15 |
# File 'lib/hanami/sprockets/middleware.rb', line 12 def initialize(app, assets) @app = app @assets = assets end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/hanami/sprockets/middleware.rb', line 19 def call(env) request = Rack::Request.new(env) # Check if this is an asset request if asset_request?(request.path) serve_asset(request.path) else @app.call(env) end end |