<commit_before>module HipaaCrypt
  module Attributes
    module ActiveRecord
      module RelationAdditions

        def where(opts, *rest)
          # return super(opts, *rest) unless opts.is_a? Hash
          encrypted_opts = opts.reduce({}) do |hash, (key, value)|
            hash[key] = opts.delete(key) if attribute_encrypted? key
            hash
          end
          query          = super(opts, *rest)
          encrypted_opts.present? ? query.encrypted_where(encrypted_opts) : query
        end

        protected

        def encrypted_where(opts)
          grouped_opts = opts.group_by do |attr, v|
            opts = encryptor_for(attr).options
            opts.raw_value(:iv).is_a?(String) && opts.raw_value(:key).is_a?(String) ? :static : :dynamic<commit_msg>don't invoke special where unless the args is a hash<commit_after>module HipaaCrypt
  module Attributes
    module ActiveRecord
      module RelationAdditions

        def where(opts, *rest)
          return super(opts, *rest) unless opts.is_a? Hash
          encrypted_opts = opts.reduce({}) do |hash, (key, value)|
            hash[key] = opts.delete(key) if attribute_encrypted? key
            hash
          end
          query          = super(opts, *rest)
          encrypted_opts.present? ? query.encrypted_where(encrypted_opts) : query
        end

        protected

        def encrypted_where(opts)
          grouped_opts = opts.group_by do |attr, v|
            opts = encryptor_for(attr).options
            opts.raw_value(:iv).is_a?(String) && opts.raw_value(:key).is_a?(String) ? :static : :dynamic
{'fraction_non_alphanumeric': 0.09805153991200503, 'fraction_numerical': 0.0, 'mean_word_length': 2.30977130977131, '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': '1791049', 'n_tokens_mistral': 471, 'n_tokens_neox': 459, 'n_words': 110}