Class: Falconer::Rack
- Inherits:
-
Object
- Object
- Falconer::Rack
- Defined in:
- lib/falconer/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app) ⇒ Rack
Returns a new instance of Rack.
4 5 6 |
# File 'lib/falconer/rack.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/falconer/rack.rb', line 8 def call(env) unless env['PATH_INFO'] == '/@falconer-poll' status, headers, response = @app.call(env) else status = 200 headers = {'Content-Length'=> '0'} response = [''] end if env[Falconer::ACCEPT_HEADER_ENV] headers[Falconer::EVENTS_HEADER] = Falconer.flush.to_json end [status, headers, response] end |