<commit_before>module RorVsWild
  module Plugin
    class Redis
      def self.setup
        return if !defined?(::Redis)
        if ::Redis::Client.method_defined?(:process)
          ::Redis::Client.prepend(V4)
        else
          ::Redis.prepend(V5)
        end
      end

      module V4
        def process(commands, &block)
          string = commands.map(&:first).join("\n")
          appendable = APPENDABLE_COMMANDS.include?(commands[0][0])
          RorVsWild.agent.measure_section(string, appendable_command: appendable, kind: "redis".freeze) do
            super(commands, &block)
          end
        end
      end

      module V5
        def send_command(command, &block)
          appendable = APPENDABLE_COMMANDS.include?(command)
          RorVsWild.agent.measure_section(command[0], appendable_command: appendable, kind: "redis".freeze) do
            super(command, &block)
          end
        end

        def pipelined
          RorVsWild.agent.measure_section("pipeline", kind: "redis".freeze) { super }
        end

        def multi
          RorVsWild.agent.measure_section("multi", kind: "redis".freeze) { super }
        end
      end

      APPENDABLE_COMMANDS = [:auth, :select]
    end
  end
end<commit_msg>Use frozen literal string for Redis plugin<commit_after># frozen_string_literal: true

module RorVsWild
  module Plugin
    class Redis
      def self.setup
        return if !defined?(::Redis)
        if ::Redis::Client.method_defined?(:process)
          ::Redis::Client.prepend(V4)
        else
          ::Redis.prepend(V5)
        end
      end

      module V4
        def process(commands, &block)
          string = commands.map(&:first).join("\n")
          appendable = APPENDABLE_COMMANDS.include?(commands[0][0])
          RorVsWild.agent.measure_section(string, appendable_command: appendable, kind: "redis") do
            super(commands, &block)
          end
        end
      end

      module V5
        def send_command(command, &block)
          appendable = APPENDABLE_COMMANDS.include?(command)
          RorVsWild.agent.measure_section(command[0], appendable_command: appendable, kind: "redis") do
            super(command, &block)
          end
        end

        def pipelined
          RorVsWild.agent.measure_section("pipeline", kind: "redis") { super }
        end

        def multi
          RorVsWild.agent.measure_section("multi", kind: "redis") { super }
        end
      end

      APPENDABLE_COMMANDS = [:auth, :select]
    end
  end
end
{'fraction_non_alphanumeric': 0.10158730158730159, 'fraction_numerical': 0.005555555555555556, 'mean_word_length': 2.17906683480454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4527686', 'n_tokens_mistral': 786, 'n_tokens_neox': 761, 'n_words': 160}