<commit_before>require 'active_support/concern'

module WatCatcher
  module CatcherOfWats
    extend ActiveSupport::Concern

    included do
      around_filter :catch_wats

      helper_method :wat_user
    end

    def wat_user
      current_user
    end

    def disable_wat_report
      env["wat_report_disabled"] = true
    end

    def report_wat?
      !!(env["wat_report"].present? && !env["wat_report_disabled"])
    end

    def catch_wats(&block)
      block.call
    rescue Exception => e
      user = nil
      begin
        user = wat_user
      rescue;end
      env["wat_report"] = {
        request: request,
        user: user
      }
      raise
    end
  end
end
<commit_msg>Fix Rails 5 deprecation warnings<commit_after>require 'active_support/concern'

module WatCatcher
  module CatcherOfWats
    extend ActiveSupport::Concern

    included do
      around_action :catch_wats

      helper_method :wat_user
    end

    def wat_user
      current_user
    end

    def disable_wat_report
      request.env["wat_report_disabled"] = true
    end

    def report_wat?
      !!(request.env["wat_report"].present? && !request.env["wat_report_disabled"])
    end

    def catch_wats(&block)
      block.call
    rescue Exception => e
      user = nil
      begin
        user = wat_user
      rescue;end
      request.env["wat_report"] = {
        request: request,
        user: user
      }
      raise
    end
  end
end

{'fraction_non_alphanumeric': 0.07505211952744961, 'fraction_numerical': 0.0006949270326615705, 'mean_word_length': 2.2653061224489797, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3824543', 'n_tokens_mistral': 471, 'n_tokens_neox': 439, 'n_words': 104}