<commit_before>module Stale
  module Model
    IDENTIFIER = :stale_key

    def stale_id
      to_param
    end

    def stale_key
      Stale.interface.key_for_model(self.class, stale_id)
    end

    def expire_stale_dependencies
      Stale.interface.expire_dependencies(stale_key)
    end
  end
end<commit_msg>Register callback when including model helper<commit_after>module Stale
  module Model
    IDENTIFIER = :stale_key

    def self.included(base)
      base.class_eval do
        after_commit :expire_stale_dependencies if respond_to?(:after_commit)
      end
    end

    def stale_id
      to_param
    end

    def stale_key
      Stale.interface.key_for_model(self.class, stale_id)
    end

    def expire_stale_dependencies
      Stale.interface.expire_dependencies(stale_key)
    end
  end
end
{'fraction_non_alphanumeric': 0.04814814814814815, 'fraction_numerical': 0.0, 'mean_word_length': 2.9560975609756097, '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': '7204340', 'n_tokens_mistral': 283, 'n_tokens_neox': 259, 'n_words': 56}