Sha256: f68cd562cd3bdef627ba7b70f0fde16a065780cf086703c277389219d64e6e89

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 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.4 lib/ahoy_email/mailer.rb
ahoy_email-0.2.3 lib/ahoy_email/mailer.rb