<commit_before>module Paperclip
  module Validators
    class AttachmentContentTypeValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        attribute = "#{attribute}_content_type".to_sym
        value = record.send(:read_attribute_for_validation, attribute)
        allowed_types = [options[:content_type]].flatten

        if value.present? 
          unless allowed_types.any? { |type| type === value }
            record.errors.add(attribute, :invalid, options.merge(
              :types => allowed_types.join(', ')
            ))
          end
        end<commit_msg>Clean up AttachmentContentTypeValidator conditions<commit_after>module Paperclip
  module Validators
    class AttachmentContentTypeValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        attribute = "#{attribute}_content_type".to_sym
        value = record.send(:read_attribute_for_validation, attribute)
        allowed_types = [options[:content_type]].flatten

        if value.present? && allowed_types.none? { |type| type === value }
          record.errors.add(attribute, :invalid, options.merge(
            :types => allowed_types.join(', ')
          ))
        end
{'fraction_non_alphanumeric': 0.09942950285248574, 'fraction_numerical': 0.0, 'mean_word_length': 3.0933333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3313954', 'n_tokens_mistral': 316, 'n_tokens_neox': 312, 'n_words': 64}