Sha256: a7361f04198711739082195ade759fe1edfa78f55d094ad9d90ba174398d8f15

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

module AhoyEmail
  module Mailer

    def self.included(base)
      base.extend ClassMethods
      base.class_eval do
        attr_accessor :ahoy_options
        class_attribute :ahoy_options
        self.ahoy_options = {}
        alias_method_chain :mail, :ahoy
      end
    end

    module ClassMethods
      def track(options = {})
        self.ahoy_options = ahoy_options.merge(message: true).merge(options)
      end
    end

    def track(options = {})
      self.ahoy_options = (ahoy_options || {}).merge(message: true).merge(options)
    end

    def mail_with_ahoy(headers = {}, &block)
      message = mail_without_ahoy(headers, &block)
      AhoyEmail::Processor.new(message, self).process
      message
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ahoy_email-0.2.2 lib/ahoy_email/mailer.rb
ahoy_email-0.2.1 lib/ahoy_email/mailer.rb