<commit_before>require "active_support/concern"

module WithUuid
  module Model

	  extend ActiveSupport::Concern

	  included do

      self.primary_key = :id

      before_validation :set_id
      before_create     :set_id

	  end

    def set_id
      return unless id.blank?

      # Assign generated COMBination GUID to #id
      write_attribute( :id, WithUuid::CombUuid.uuid.to_s )
    end

  end
end<commit_msg>Add callbacks to UUID setting.<commit_after>require "active_support/concern"

module WithUuid
  module Model

	  extend ActiveSupport::Concern

	  included do

      self.primary_key = :id

      before_validation :set_id
      before_create     :set_id

	  end

  protected

    def set_id
      return unless id.blank?

      uuid = WithUuid::CombUuid.uuid.to_s
      before_set_id( uuid )
      write_attribute( :id, uuid )
      after_set_id( uuid )
    end

    def before_set_id( uuid ); end
    def after_set_id( uuid );  end

  end
end
{'fraction_non_alphanumeric': 0.062434963579604576, 'fraction_numerical': 0.0, 'mean_word_length': 2.6165413533834587, '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': '3477330', 'n_tokens_mistral': 332, 'n_tokens_neox': 310, 'n_words': 80}