<commit_before>module Airbrake
  class UserInformer
    def initialize(app)
      @app = app
    end

    def replacement(with)
      @replacement ||= Airbrake.configuration.user_information.gsub(/\{\{\s*error_id\s*\}\}/, with.to_s)
    end

    def call(env)
      status, headers, body = @app.call(env)
      if env['airbrake.error_id'] && Airbrake.configuration.user_information
        new_body = []
        body.each do |chunk|
          new_body << chunk.gsub("<!-- AIRBRAKE ERROR -->", replacement(env['airbrake.error_id']))
        end
        headers['Content-Length'] = new_body.sum(&:length).to_s
        body = new_body
      end
      [status, headers, body]
    end
  end
end
<commit_msg>Removed class-level caching per jkraemer: Hi,<commit_after>module Airbrake
  class UserInformer
    def initialize(app)
      @app = app
    end

    def replacement(with)
      Airbrake.configuration.user_information.gsub(/\{\{\s*error_id\s*\}\}/, with.to_s)
    end

    def call(env)
      status, headers, body = @app.call(env)
      if env['airbrake.error_id'] && Airbrake.configuration.user_information
        new_body = []
        replace  = replacement(env['airbrake.error_id'])
        body.each do |chunk|
          new_body << chunk.gsub("<!-- AIRBRAKE ERROR -->", replace)
        end
        headers['Content-Length'] = new_body.sum(&:length).to_s
        body = new_body
      end
      [status, headers, body]
    end
  end
end

{'fraction_non_alphanumeric': 0.13416320885200553, 'fraction_numerical': 0.0, 'mean_word_length': 2.5206812652068127, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3490794', 'n_tokens_mistral': 480, 'n_tokens_neox': 471, 'n_words': 96}