Class: TemplateStreaming::Autoflushing::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/template_streaming/autoflushing.rb

Defined Under Namespace

Classes: BodyProxy

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



50
51
52
# File 'lib/template_streaming/autoflushing.rb', line 50

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/template_streaming/autoflushing.rb', line 54

def call(env)
  response = @app.call(env)
  if env[STREAMING_KEY] && TemplateStreaming.autoflush
    response[2] = BodyProxy.new(response[2])
  end
  response
end