Sha256: 5e946e6194660dfdf09bed907ed3fb3e9283531abac9b44f022b57ea5ab299e0

Contents?: true

Size: 366 Bytes

Versions: 3

Compression:

Stored size: 366 Bytes

Contents

module EmailSpec::MailExt
  def default_part
    @default_part ||= html_part || text_part || self
  end

  def default_part_body
    # Calling to_str as we want the actual String object
    HTMLEntities.new.decode(default_part.decoded.to_s.to_str)
  end

  def html
    html_part ? html_part.decoded : nil
  end
end

Mail::Message.send(:include, EmailSpec::MailExt)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
email_spec-2.3.0 lib/email_spec/mail_ext.rb
email_spec-2.2.2 lib/email_spec/mail_ext.rb
email_spec-2.2.1 lib/email_spec/mail_ext.rb