Parent

HoptoadNotifier::UserInformer

Public Class Methods

new(app) click to toggle source
# File lib/hoptoad_notifier/user_informer.rb, line 3
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/hoptoad_notifier/user_informer.rb, line 11
def call(env)
  status, headers, body = @app.call(env)
  if env['hoptoad.error_id'] && HoptoadNotifier.configuration.user_information
    new_body = []
    body.each do |chunk|
      new_body << chunk.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
    end
    headers['Content-Length'] = new_body.sum(&:length).to_s
    body = new_body
  end
  [status, headers, body]
end
replacement(with) click to toggle source
# File lib/hoptoad_notifier/user_informer.rb, line 7
def replacement(with)
  @replacement ||= HoptoadNotifier.configuration.user_information.gsub(/\{\{\s*error_id\s*\}\}/, with.to_s)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.