<commit_before>module MessageCenter
  
  def sendMessageToUser(user, subject, body)
    raise MessageException::ParameterShouldBeUser.new('Group should be an array') unless user.is_a? User
    @message = Message.create(:subject => subject, :body => body, :sender_id => current_user.id, :receiver_id => user.id, :is_read => 0)
    
    
    
    markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
    markdown_body = markdown.render(body)
    mail_footer = render_to_string "messages/mail_footer", :layout => false
    
    if user.notify_by_email && !Rails.env.test?
      %x[sendmail #{user.email} << EOF
Subject: #{subject}
From: #{ENV['notification_email']}
To: #{user.email}
Content-type: text/html
MIME-Version: 1.0

#{markdown_body}

#{mail_footer}
EOF]
    end<commit_msg>Small optimization<commit_after>module MessageCenter
  
  def sendMessageToUser(user, subject, body)
    raise MessageException::ParameterShouldBeUser.new('Group should be an array') unless user.is_a? User
    @message = Message.create(:subject => subject, :body => body, :sender_id => current_user.id, :receiver_id => user.id, :is_read => 0)
    
    if user.notify_by_email && !Rails.env.test?
      markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
      markdown_body = markdown.render(body)
      mail_footer = render_to_string "messages/mail_footer", :layout => false
      
      %x[sendmail #{user.email} << EOF
Subject: #{subject}
From: #{ENV['notification_email']}
To: #{user.email}
Content-type: text/html
MIME-Version: 1.0

#{markdown_body}

#{mail_footer}
EOF]
    end
{'fraction_non_alphanumeric': 0.13953488372093023, 'fraction_numerical': 0.0035778175313059034, 'mean_word_length': 4.593333333333334, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '5188725', 'n_tokens_mistral': 564, 'n_tokens_neox': 553, 'n_words': 118}