Class: Sidekiq::Kicks::Web::ScriptInjector
- Inherits:
-
Object
- Object
- Sidekiq::Kicks::Web::ScriptInjector
- Defined in:
- lib/sidekiq/kicks/web.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ScriptInjector
constructor
A new instance of ScriptInjector.
Constructor Details
#initialize(app) ⇒ ScriptInjector
Returns a new instance of ScriptInjector.
12 13 14 |
# File 'lib/sidekiq/kicks/web.rb', line 12 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sidekiq/kicks/web.rb', line 16 def call(env) status, headers, body = @app.call(env) if html_response?(headers) && inject_path?(env) body = inject_script(body, env) headers.delete("Content-Length") end [status, headers, body] end |