Sha256: 670d773c826a0bee6c2222aeeeb29981991f75b02e7ee12a7fce4cf75f8d6d78

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module ActionMailer
  module Text
    def self.included(klass)
      klass.class_eval do
        include ActionMailer::Text::HtmlToPlainText
      end
    end

    def collect_responses(headers)
      responses = super headers
      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: convert_to_text(html_part[:body])
        headers[:parts_order] = ['text/plain'] + headers[:parts_order] unless headers[:parts_order].include?('text/plain')
      end
      responses
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionmailer-textgiri-0.1.2 lib/actionmailer-text/text.rb