Sha256: e2e9f598c5d56effdb14cf395a08d4c8479061517768cab13f9c218bcb4f06df
Contents?: true
Size: 611 Bytes
Versions: 4
Compression:
Stored size: 611 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'] body.each_with_index do |chunk, i| body[i] = chunk.to_s.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id'])) end headers['Content-Length'] = body.sum(&:length).to_s end [status, headers, body] end end end
Version data entries
4 entries across 4 versions & 2 rubygems