Class: Broadcast::Medium::Email
- Inherits:
-
Broadcast::Medium
- Object
- Broadcast::Medium
- Broadcast::Medium::Email
- Defined in:
- lib/broadcast/media/email.rb
Instance Method Summary collapse
Methods inherited from Broadcast::Medium
#initialize, #namespace, #options
Constructor Details
This class inherits a constructor from Broadcast::Medium
Instance Method Details
#publish(message) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/broadcast/media/email.rb', line 5 def publish() recipients = .recipients.is_a?(Array) ? .recipients : [.recipients] = self. recipients.compact.each do |recipient| mail = Mail.new do from .sender || .class.to_s to recipient subject .subject || .class.to_s body .body end if .delivery_method # ensure the delivery options has symbolized keys # Addresses https://github.com/futuresimple/broadcast/issues/9 = ..inject({}) do |memo, setting| memo[setting[0].to_s.to_sym] = setting[1] memo end mail.delivery_method .delivery_method, || {} end mail.deliver end end |