<commit_before>module Verifiable
  module Models
    def acts_as_verifiable(attribute, delivery:, token:)
      before_update :"reset_#{attribute}_verification", if: :"#{attribute}_changed?"

      define_method :"generate_#{attribute}_verification_token!" do
        send("#{attribute}_verification_token=",   token.call)
        send("#{attribute}_verification_sent_at=", Time.now)
        save
      end

      define_method :"verify_#{attribute}!" do
        send("#{attribute}_verification_token=", nil)
        send("#{attribute}_verified_at=", Time.now)
        save
      end

      define_method :"send_#{attribute}_verification_instructions" do
        delivery
        .send("#{attribute}_verification_instructions", self)
        .deliver_now
      end

      define_method :"#{attribute}_verified?" do
        !send("#{attribute}_verified_at").nil?
      end

      private

      define_method :"reset_#{attribute}_verification" do
        [
          :verification_token, :verification_sent_at, :verified_at
        ].each do |suffix|
          send("#{attribute}_#{suffix}=", nil)
        end
      end
    end
  end
  ApplicationRecord.extend Models<commit_msg>add proper public_send in acts_as_verifiable<commit_after>module Verifiable
  module Models
    def acts_as_verifiable(attribute, delivery:, token:)
      before_update :"reset_#{attribute}_verification", if: :"#{attribute}_changed?"

      define_method :"generate_#{attribute}_verification_token!" do
        public_send("#{attribute}_verification_token=",   token.call)
        public_send("#{attribute}_verification_sent_at=", Time.now)
        save
      end

      define_method :"verify_#{attribute}!" do
        public_send("#{attribute}_verification_token=", nil)
        public_send("#{attribute}_verified_at=", Time.now)
        save
      end

      define_method :"send_#{attribute}_verification_instructions" do
        delivery
        .public_send("#{attribute}_verification_instructions", self)
        .deliver_now
      end

      define_method :"#{attribute}_verified?" do
        !public_send("#{attribute}_verified_at").nil?
      end

      private

      define_method :"reset_#{attribute}_verification" do
        [
          :verification_token, :verification_sent_at, :verified_at
        ].each do |suffix|
          public_send("#{attribute}_#{suffix}=", nil)
        end
      end
    end
  end
  ApplicationRecord.extend Models
{'fraction_non_alphanumeric': 0.11412151067323481, 'fraction_numerical': 0.0, 'mean_word_length': 3.208981001727116, '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': '1775717', 'n_tokens_mistral': 712, 'n_tokens_neox': 709, 'n_words': 125}