<commit_before>module MyFeeds
  module Identify
    extend ActiveSupport::Concern

    included do
      before_save :save_feed_indentify
      class_attribute :feed_polymorphic_name
      self.feed_polymorphic_name = self == Feed ? :source : default_feed_polymorphic_name
      delegate :default_feed_polymorphic_name, :polymorphic_indentify_column, :polymorphic_id_column, :polymorphic_type_column, to: :class
    end

    protected
    def save_feed_indentify
      instance_eval %Q{self.#{polymorphic_indentify_column} = #{polymorphic_id_column}.to_s + #{polymorphic_type_column}.to_s.underscore}
    end

    private
    module ClassMethods
      def default_feed_polymorphic_name
        self.to_s.underscore
      end

      def polymorphic_indentify_column
        "#{feed_polymorphic_name}_indentify"
      end

      def polymorphic_id_column
        "#{feed_polymorphic_name}_id"
      end

      def polymorphic_type_column
        "#{feed_polymorphic_name}_type"
      end
    end
  end
end
<commit_msg>fix delegate<commit_after>module MyFeeds
  module Identify
    extend ActiveSupport::Concern

    included do
      before_save :save_feed_indentify
      class_attribute :feed_polymorphic_name
      self.feed_polymorphic_name = self == Feed ? :source : default_feed_polymorphic_name
      delegate :default_feed_polymorphic_name, :polymorphic_indentify_column, :polymorphic_id_column, :polymorphic_type_column, to: :"self.class"
    end

    protected
    def save_feed_indentify
      instance_eval %Q{self.#{polymorphic_indentify_column} = #{polymorphic_id_column}.to_s + #{polymorphic_type_column}.to_s.underscore}
    end

    private
    module ClassMethods
      def default_feed_polymorphic_name
        self.to_s.underscore
      end

      def polymorphic_indentify_column
        "#{feed_polymorphic_name}_indentify"
      end

      def polymorphic_id_column
        "#{feed_polymorphic_name}_id"
      end

      def polymorphic_type_column
        "#{feed_polymorphic_name}_type"
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05937193326790972, 'fraction_numerical': 0.0, 'mean_word_length': 3.5210643015521064, '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': '7186970', 'n_tokens_mistral': 702, 'n_tokens_neox': 643, 'n_words': 111}