Module: ActionMailer::Html2Text
- Defined in:
- lib/actionmailer-html2text.rb,
lib/actionmailer-html2text/version.rb
Constant Summary collapse
- TEXT_PLAIN =
"text/plain"- TEXT_HTML =
"text/html"- VERSION =
"0.2.0"
Instance Method Summary collapse
Instance Method Details
#add_plain_text(responses) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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) ⇒ Object
8 9 10 |
# File 'lib/actionmailer-html2text.rb', line 8 def collect_responses(headers) add_plain_text(super(headers)) end |