Module: CourierRails::DataOptions::InstanceMethods

Defined in:
lib/courier_rails/data_options.rb

Instance Method Summary collapse

Instance Method Details

#mail(headers = {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/courier_rails/data_options.rb', line 10

def mail(headers = {}, &block)
  headers = headers.clone
  courier_data = headers.delete(:courier_data)
  courier_data ||= {}
  super(headers, &block).tap do |message|
    message.singleton_class.class_eval { attr_accessor "courier_data" }
    message.courier_data = courier_data
  end
end