Class: Propshaft::QuietAssets

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/quiet_assets.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ QuietAssets

Returns a new instance of QuietAssets.



2
3
4
5
# File 'lib/propshaft/quiet_assets.rb', line 2

def initialize(app)
  @app = app
  @assets_regex = %r(\A/{0,2}#{::Rails.application.config.assets.prefix})
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/propshaft/quiet_assets.rb', line 7

def call(env)
  if env['PATH_INFO'] =~ @assets_regex
    ::Rails.logger.silence { @app.call(env) }
  else
    @app.call(env)
  end
end