lib/ahoy_email/mailer.rb in ahoy_email-0.2.0 vs lib/ahoy_email/mailer.rb in ahoy_email-0.2.1
- old
+ new
@@ -2,36 +2,29 @@
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)
+ def track(options = {})
self.ahoy_options = ahoy_options.merge(message: true).merge(options)
end
end
- def track(options)
- @ahoy_options = (@ahoy_options || {}).merge(message: true).merge(options)
+ 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)
-
- options = AhoyEmail.options.merge(self.class.ahoy_options).merge(@ahoy_options || {})
- options.each do |k, v|
- if v.respond_to?(:call)
- options[k] = v.call(message, self)
- end
- end
- AhoyEmail::Processor.new(message, options).process
-
+ AhoyEmail::Processor.new(message, self).process
message
end
end
end