Sha256: d4308f0ffba8483d15e6cff0f26d152fc5a015fc6487b0d0758b9af10cc58ca7
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
module HoptoadNotifier class UserInformer def initialize(app) @app = app end def replacement(with) @replacement ||= HoptoadNotifier.configuration.user_information.gsub(/\{\{\s*error_id\s*\}\}/, with.to_s) end 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hoptoad_notifier-2.4.11 | lib/hoptoad_notifier/user_informer.rb |
hoptoad_notifier-2.4.10 | lib/hoptoad_notifier/user_informer.rb |
hoptoad_notifier-2.4.9 | lib/hoptoad_notifier/user_informer.rb |