<commit_before>module ActiveAdminJcrop
  module AssetEngine
    class <<self
      def thumbnail_names(obj, field)
        obj.send(field).styles.keys
      end

      def crop!(obj, field)
        obj.send(field).reprocess!
      end
    end
  end
end

module Paperclip

  module NewClassMethods
    def has_attached_file(*args)
      super

      self.attachment_definitions.each do |name, options|
        options[:processors] ||= []
        options[:processors] << :active_admin_jcropper
      end
    end
  end

  module ClassMethods
    def self.extended(base)
      super
      base.send :extend, ::Paperclip::NewClassMethods
    end
  end

  class ActiveAdminJcropper < Thumbnail
    def transformation_command
      if @attachment.instance.active_admin_cropping?
        ary = super<commit_msg>Add active_admin_jcropper processor only once per attached file<commit_after>module ActiveAdminJcrop
  module AssetEngine
    class <<self
      def thumbnail_names(obj, field)
        obj.send(field).styles.keys
      end

      def crop!(obj, field)
        obj.send(field).reprocess!
      end
    end
  end
end

module Paperclip

  module NewClassMethods
    def has_attached_file(*args)
      super

      attribute_name = args[0]
      definition = attachment_definitions[attribute_name]
      definition[:processors] ||= []

      unless definition[:processors].include?(:active_admin_jcropper)
        definition[:processors] << :active_admin_jcropper
      end
    end
  end

  module ClassMethods
    def self.extended(base)
      super
      base.send :extend, ::Paperclip::NewClassMethods
    end
  end

  class ActiveAdminJcropper < Thumbnail
    def transformation_command
      if @attachment.instance.active_admin_cropping?
        ary = super
{'fraction_non_alphanumeric': 0.07321225879682179, 'fraction_numerical': 0.0005675368898978433, 'mean_word_length': 2.849344978165939, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4222518', 'n_tokens_mistral': 533, 'n_tokens_neox': 507, 'n_words': 118}