<commit_before>module Subscribable
  def self.included klass
    klass.class_eval do
      has_many :subscriptions, :as => :subscribable, :dependent => :destroy, :autosave => true
      before_create :set_default_subscriptions
      extend ClassMethods
    end
  end

  def current_users_subscription
    subscriptions.detect { |ss| ss.person == User.current_user.person }
  end

  def subscribed?
    !current_users_subscription.nil?
  end

  def subscribed= subscribed
    if subscribed
      subscribe
    else
      unsubscribe
    end
  end

  def subscribe
    subscriptions.build :person => User.current_user.person, :project => project unless subscribed?
  end

  def unsubscribe
    current_users_subscription.try(:destroy)
  end

  def send_immediate_subscriptions activity_log
    subscriptions.each do |subscription|
      if subscription.immediately? and subscribers_are_notified_of? activity_log.action
        SubMailer.deliver_send_immediate_subscription subscription.person, activity_log
      end
    end
  end

  def subscribers_are_notified_of? action
    self.class.subscribers_are_notified_of? action
  end

  def set_default_subscriptions
    Person.all.each do |person|
      if project_subscription = person.project_subscriptions.detect {|s| s.project == self.project}
        subscriptions.build :person => person unless project_subscription.unsubscribed_types.include? self.class.name
      end
    end
  end

  module ClassMethods
    def subscribers_are_notified_of? action
      action != 'show' and action != 'download'
    end
  end
end

ActiveRecord::Base.class_eval do
  def self.subscribable?
    include? Subscribable
  end<commit_msg>corrected typo in method name<commit_after>module Subscribable
  def self.included klass
    klass.class_eval do
      has_many :subscriptions, :as => :subscribable, :dependent => :destroy, :autosave => true
      before_create :set_default_subscriptions
      extend ClassMethods
    end
  end

  def current_users_subscription
    subscriptions.detect { |ss| ss.person == User.current_user.person }
  end

  def subscribed?
    !current_users_subscription.nil?
  end

  def subscribed= subscribed
    if subscribed
      subscribe
    else
      unsubscribe
    end
  end

  def subscribe
    subscriptions.build :person => User.current_user.person, :project => project unless subscribed?
  end

  def unsubscribe
    current_users_subscription.try(:destroy)
  end

  def send_immediate_subscription activity_log
    subscriptions.each do |subscription|
      if subscription.immediately? and subscribers_are_notified_of? activity_log.action
        SubMailer.deliver_send_immediate_subscription subscription.person, activity_log
      end
    end
  end

  def subscribers_are_notified_of? action
    self.class.subscribers_are_notified_of? action
  end

  def set_default_subscriptions
    Person.all.each do |person|
      if project_subscription = person.project_subscriptions.detect {|s| s.project == self.project}
        subscriptions.build :person => person unless project_subscription.unsubscribed_types.include? self.class.name
      end
    end
  end

  module ClassMethods
    def subscribers_are_notified_of? action
      action != 'show' and action != 'download'
    end
  end
end

ActiveRecord::Base.class_eval do
  def self.subscribable?
    include? Subscribable
  end
{'fraction_non_alphanumeric': 0.06196008340780459, 'fraction_numerical': 0.0, 'mean_word_length': 3.6317241379310343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5174253', 'n_tokens_mistral': 999, 'n_tokens_neox': 977, 'n_words': 241}