<commit_before>module Refile
  module ActiveRecord
    module Attachment
      include Refile::Attachment

      # Attachment method which hooks into ActiveRecord models
      #
      # @see Refile::Attachment#attachment
      def attachment(name, raise_errors: false, **)
        super

        attacher = "#{name}_attacher"

        validate do
          errors = send(attacher).errors
          self.errors.add(name, *errors) unless errors.empty?
        end

        before_save do
          send(attacher).store!
        end

        after_destroy do
          send(attacher).delete!
        end
      end
    end
  end
end
<commit_msg>Work around bug in Ruby 2.2, closes #71<commit_after>module Refile
  module ActiveRecord
    module Attachment
      include Refile::Attachment

      # Attachment method which hooks into ActiveRecord models
      #
      # @see Refile::Attachment#attachment
      def attachment(name, raise_errors: false, **options)
        super

        attacher = "#{name}_attacher"

        validate do
          errors = send(attacher).errors
          self.errors.add(name, *errors) unless errors.empty?
        end

        before_save do
          send(attacher).store!
        end

        after_destroy do
          send(attacher).delete!
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07072243346007605, 'fraction_numerical': 0.003041825095057034, 'mean_word_length': 2.011441647597254, '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': '657132', 'n_tokens_mistral': 360, 'n_tokens_neox': 350, 'n_words': 98}