<commit_before>class CoolEvent < ActiveRecord::Base
  belongs_to :subscriber, :class_name => 'User'
  belongs_to :source, :polymorphic => true

  class << self
    @@types = []
    
    # The following options are required:
    #  :source  => the object where the event was triggered (although this can be any relevant object)
    def trigger(options = {})
      self.subscribers_to(options[:source]).each do |subscriber|
        self.create! :subscriber => subscriber, :source => options[:source]
      end      
    end  

    # TODO: This should only be available on base class?
    def types
      load_subclasses if @@types.empty?
      @@types
    end

    def title
      self.class.to_s.gsub(/Event$/, '').underscore.gsub(/_/,' ')
    end

    protected

    def subscribers_to(source)
      EventSubscription.of_type(self).collect(&:subscriber)
    end
    
    private<commit_msg>fixed public title method on CoolEvent<commit_after>class CoolEvent < ActiveRecord::Base
  belongs_to :subscriber, :class_name => 'User'
  belongs_to :source, :polymorphic => true

  class << self
    @@types = []
    
    # The following options are required:
    #  :source  => the object where the event was triggered (although this can be any relevant object)
    def trigger(options = {})
      self.subscribers_to(options[:source]).each do |subscriber|
        self.create! :subscriber => subscriber, :source => options[:source]
      end      
    end  

    # TODO: This should only be available on base class?
    def types
      load_subclasses if @@types.empty?
      @@types
    end

    def title
      self.to_s.gsub(/Event$/, '').underscore.gsub(/_/,' ')
    end

    protected

    def subscribers_to(source)
      EventSubscription.of_type(self).collect(&:subscriber)
    end
    
    private
{'fraction_non_alphanumeric': 0.10839355197331851, 'fraction_numerical': 0.0, 'mean_word_length': 2.821656050955414, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '3258894', 'n_tokens_mistral': 545, 'n_tokens_neox': 526, 'n_words': 150}