<commit_before>Spree::BaseHelper.module_eval do
  def link_to_cart(text = t('cart'))
    css_class = nil
    if current_order.nil? or current_order.line_items.empty?
      text = "#{text}"
      css_class = 'empty'
    else
      text = "#{text} (#{current_order.item_count})"
      css_class = 'full'
    end
    link_to text, cart_path, :class => css_class
  end
  
  # Outputs the corresponding flash message if any are set
  def flash_messages
    result_content = %w(notice warning error).map do |msg|
      content_tag(:script,
      		"$.jGrowl(\"#{flash[msg.to_sym]}\", { header: '#{t(msg, :default => msg).mb_chars.titleize}', sticky: true, theme: '#{msg}' });".html_safe
			) unless flash[msg.to_sym].blank?
    end.join("\n").html_safe
    flash.clear
    
    result_content
  end
end
<commit_msg>Исправлена ошибка неправильной очистки flash сообщений<commit_after>Spree::BaseHelper.module_eval do
  def link_to_cart(text = t('cart'))
    css_class = nil
    if current_order.nil? or current_order.line_items.empty?
      text = "#{text}"
      css_class = 'empty'
    else
      text = "#{text} (#{current_order.item_count})"
      css_class = 'full'
    end
    link_to text, cart_path, :class => css_class
  end
  
  # Outputs the corresponding flash message if any are set
  def flash_messages
    %w(notice warning error).map do |msg|
      content_tag(:script,
      		"$.jGrowl(\"#{flash.delete(msg.to_sym)}\", { header: '#{t(msg, :default => msg).mb_chars.titleize}', sticky: true, theme: '#{msg}' });".html_safe
			) unless flash[msg.to_sym].blank?
    end.join("\n").html_safe
  end
end

{'fraction_non_alphanumeric': 0.14481044126786824, 'fraction_numerical': 0.0, 'mean_word_length': 3.3869209809264307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2538867', 'n_tokens_mistral': 572, 'n_tokens_neox': 572, 'n_words': 128}