Class: WithPopup::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/with_popup/rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



4
5
6
# File 'lib/with_popup/rack.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/with_popup/rack.rb', line 8

def call(env)
  @env = env
  @status, @headers, @response = @app.call(env)
  return [@status, @headers, @response] unless need_injection?
  body = inject_js_to_the_response
  clear_param!
  [@status, @headers, [body]]
end