<commit_before>class Filters::Dkim < Filters::Base
  def filter(content)
    if active?
      Dkim.sign(content, selector: 'cuttlefish', private_key: delivery.app.dkim_key, domain: delivery.app.from_domain)
    else
      content
    end
  end

  def active?
    delivery.app.dkim_enabled && delivery.from_domain == delivery.app.from_domain
  end
end<commit_msg>Extract method<commit_after>class Filters::Dkim < Filters::Base
  def filter(content)
    filter_mail(Mail.new(content)).to_s
  end

  def filter_mail(mail)
    if active?
      Mail.new(Dkim.sign(mail.to_s, selector: 'cuttlefish', private_key: delivery.app.dkim_key, domain: delivery.app.from_domain))
    else
      mail
    end
  end

  def active?
    delivery.app.dkim_enabled && delivery.from_domain == delivery.app.from_domain
  end
end
{'fraction_non_alphanumeric': 0.10434782608695652, 'fraction_numerical': 0.0, 'mean_word_length': 3.8263473053892216, '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': '4696726', 'n_tokens_mistral': 274, 'n_tokens_neox': 271, 'n_words': 54}