Class: Sprockets::Rails2::Middleware
- Inherits:
-
Object
- Object
- Sprockets::Rails2::Middleware
- Defined in:
- lib/sprockets/rails2/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 |
# File 'lib/sprockets/rails2/middleware.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/sprockets/rails2/middleware.rb', line 9 def call(env) return @app.call(env) unless env['PATH_INFO'] =~ /^\/assets/ env['PATH_INFO'] = env['PATH_INFO'].gsub(/^\/assets/, "") env['SCRIPT_INFO'] = "" if env['SCRIPT_INFO'].nil? env['SCRIPT_INFO'] = env['SCRIPT_INFO'] + "/assets" Rails.asset_pipeline.call(env) end |