<commit_before>module LockedAttributes
  extend ActiveSupport::Concern

  included do
    validate :validate_locked_attributes, unless: :new_record?
    cattr_accessor :locked_attributes
  end

  module ClassMethods
    def lock_attributes(*args)
      self.locked_attributes = args.map(&:to_s)
    end
  end

  module InstanceMethods
    def locked_attributes
      self.class.locked_attributes || []
    end

    def validate_locked_attributes
      for attribute in locked_and_changed_attributes
        errors.add(attribute, :locked)
      end
    end

    private

    def locked_and_changed_attributes
      changed & locked_attributes
    end
  end
end<commit_msg>Remove deprecated InstanceMethods syntax<commit_after>module LockedAttributes
  extend ActiveSupport::Concern

  included do
    validate :validate_locked_attributes, unless: :new_record?
    cattr_accessor :locked_attributes
  end

  module ClassMethods
    def lock_attributes(*args)
      self.locked_attributes = args.map(&:to_s)
    end
  end

  def locked_attributes
    self.class.locked_attributes || []
  end

  def validate_locked_attributes
    for attribute in locked_and_changed_attributes
      errors.add(attribute, :locked)
    end
  end

  private

  def locked_and_changed_attributes
    changed & locked_attributes
  end
end
{'fraction_non_alphanumeric': 0.0502283105022831, 'fraction_numerical': 0.0, 'mean_word_length': 3.646643109540636, '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': '7357364', 'n_tokens_mistral': 376, 'n_tokens_neox': 362, 'n_words': 89}