class MailHandler::Receiving::FileList::Filter::ByEmailContent

filter by email content

Public Class Methods

new(files, content) click to toggle source
# File lib/mailhandler/receiving/filelist/filter/email.rb, line 40
def initialize(files, content)
  super(files)
  @content = content
end

Private Instance Methods

check_content_fast(file) click to toggle source
# File lib/mailhandler/receiving/filelist/filter/email.rb, line 47
def check_content_fast(file)
  read_file(file).include? @content
end
check_content_slow(file) click to toggle source
# File lib/mailhandler/receiving/filelist/filter/email.rb, line 51
def check_content_slow(file)
  email = read_email_from_file(file)

  if email.multipart?

    email.text_part.decoded.include?(@content) || email.html_part.decoded.include?(@content)

  else

    email.decoded.include? @content

  end
end