Class: LetterOpener::MailWithIso2022Jp

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/letter_opener/mail_with_iso_2022_jp.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



25
26
27
# File 'lib/letter_opener/mail_with_iso_2022_jp.rb', line 25

def [] key
  Array(super).map { |f| PlainField.new(f.name, Iso2022JpToUtf8.decode(f.value), f.charset) }
end

#bodyObject



9
10
11
# File 'lib/letter_opener/mail_with_iso_2022_jp.rb', line 9

def body
  Mail::Body.new(super.raw_source.encode("UTF-8", "ISO-2022-JP"))
end

#html_part(&block) ⇒ Object



13
14
15
16
17
# File 'lib/letter_opener/mail_with_iso_2022_jp.rb', line 13

def html_part &block
  if part = super
    MailWithIso2022Jp.new(part)
  end
end

#subjectObject



5
6
7
# File 'lib/letter_opener/mail_with_iso_2022_jp.rb', line 5

def subject
  Iso2022JpToUtf8.decode(super)
end

#text_part(&block) ⇒ Object



19
20
21
22
23
# File 'lib/letter_opener/mail_with_iso_2022_jp.rb', line 19

def text_part &block
  if part = super
    MailWithIso2022Jp.new(part)
  end
end