Class: Sprockets::Middleware
- Inherits:
-
Object
- Object
- Sprockets::Middleware
- Defined in:
- lib/sprockets-rack/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sprockets-rack/middleware.rb', line 2 def initialize(app, = {}) @app = app @config_files = .delete(:config_files) || .delete(:config_file).to_a @options = if @config_files.empty? if @options.include? :root if File.exist? default_config_file @config_files = [default_config_file] end else raise ArgumentError, "Sprockets::Middleware needs :root option." end end end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/sprockets-rack/middleware.rb', line 19 def call(env) if env['PATH_INFO'] == configuration[:path] response else @app.call(env) end end |