module ActionMailer::Html2Text

Constants

TEXT_HTML
TEXT_PLAIN
VERSION

Public Instance Methods

add_plain_text(responses) click to toggle source
# File lib/actionmailer-html2text.rb, line 12
def add_plain_text(responses)
  html_part = responses.detect { |response| response[:content_type] == TEXT_HTML }
  text_part = responses.detect { |response| response[:content_type] == TEXT_PLAIN }

  if html_part && !text_part
    responses.insert 0, {
      content_type: TEXT_PLAIN,
      body: ::Html2Text.convert(html_part[:body])
    }
  end

  responses
end
collect_responses(headers) click to toggle source
Calls superclass method
# File lib/actionmailer-html2text.rb, line 8
def collect_responses(headers)
  add_plain_text(super(headers))
end