<commit_before>class NotificationObserver < Mongoid::Observer
  observe :user, :node
  
  def after_create(record)
    send("after_#{record.class.underscore}_create".to_sym, record)
  end
  
  def method_missing(method, *args, &block)
    super unless method.to_s =~ /^before|after|around/
  end
  
  
  protected 
    def after_user_create(user)      
      NotificationMailer.user_welcome_email(user).deliver! unless user.email.blank?
    end 
  
end<commit_msg>use repond_to? replace method_missing check.<commit_after>class NotificationObserver < Mongoid::Observer
  observe :user, :node
  
  def after_create(record)
    callback_name = "after_#{record.class.to_s.underscore}_create".to_sym
    if respond_to?(callback_name, true)
      send(callback_name, record)
    end    
  end
  
  protected 
    def after_user_create(user)      
      NotificationMailer.user_welcome_email(user).deliver! unless user.email.blank?
    end 
  
end
{'fraction_non_alphanumeric': 0.09139213602550478, 'fraction_numerical': 0.0, 'mean_word_length': 3.781725888324873, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1668569', 'n_tokens_mistral': 311, 'n_tokens_neox': 305, 'n_words': 56}