Class: TemplateStreaming::NewRelic::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



89
90
91
# File 'lib/template_streaming/new_relic.rb', line 89

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/template_streaming/new_relic.rb', line 93

def call(env)
  @env = env
  status, headers, @body = @app.call(env)
  [status, headers, self]
rescue Exception => error
  agent.finish_accumulating
  raise
end

#each(&block) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/template_streaming/new_relic.rb', line 102

def each(&block)
  in_controller_scope do
    @body.each(&block)
  end
ensure
  agent.finish_accumulating
end