Sha256: 4a893a558ce81d858e954c58365d0f891d1df4c074eef34c525b9e2af0a4d66c

Contents?: true

Size: 725 Bytes

Versions: 12

Compression:

Stored size: 725 Bytes

Contents

module Roadie
  module Rails
    class MailInliner
      attr_reader :email, :options

      def initialize(email, options)
        @email = email
        @options = options
      end

      def execute
        if options
          improve_body if email.content_type =~ /^text\/html/
          improve_html_part(email.html_part) if email.html_part
        end
        email
      end

      private
      def improve_body
        email.body = transform_html(email.body.decoded)
      end

      def improve_html_part(html_part)
        html_part.body = transform_html(html_part.body.decoded)
      end

      def transform_html(old_html)
        DocumentBuilder.build(old_html, options).transform
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
roadie-rails-1.3.0 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.2.1 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.2.0 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.1.1 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.1.0 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.1.0.rc2 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.1.0.rc1 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.0.6 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.0.5 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.0.4 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.0.3 lib/roadie/rails/mail_inliner.rb
roadie-rails-1.0.2 lib/roadie/rails/mail_inliner.rb