lib/honeybadger/rack/user_feedback.rb in honeybadger-2.7.2 vs lib/honeybadger/rack/user_feedback.rb in honeybadger-3.0.0.beta1

- old
+ new

@@ -17,16 +17,17 @@ module Honeybadger module Rack class UserFeedback extend Forwardable - def initialize(app, config) + def initialize(app, agent = nil) @app = app - @config = config + @agent = agent.kind_of?(Agent) ? agent : Honeybadger::Agent.instance end def call(env) + return @app.call(env) unless config[:'feedback.enabled'] status, headers, body = @app.call(env) if env['honeybadger.error_id'] && form = render_form(env['honeybadger.error_id']) new_body = [] body.each do |chunk| new_body << chunk.gsub("<!-- HONEYBADGER FEEDBACK -->", form) @@ -65,10 +66,11 @@ end end private - attr_reader :config - def_delegator :@config, :logger + attr_reader :agent + def_delegator :agent, :config + def_delegator :config, :logger end end end