Sha256: 3bc6f28ccfc480f17672c2f7aea690c9ad7f8a1f69ff47d56968a717092ff492
Contents?: true
Size: 999 Bytes
Versions: 5
Compression:
Stored size: 999 Bytes
Contents
module Gossiper class Mailer < ActionMailer::Base def mail_for(notification) config = config_for(notification) config.attachments.each do |filename, file| attachments[filename] = file end @notification = NotificationDecorator.new(notification) config.instance_variables.each do |name, value| instance_variable_set("@#{name}", value) end mail( from: config.from, to: config.to, cc: config.cc, bcc: config.bcc, subject: config.subject, template_name: config.template_name, template_path: config.template_path ) end def config_for(notification) begin klass = "Notifications::#{notification.kind.classify}Notification" klass.constantize.new(notification) rescue NameError klass = Gossiper.configuration.default_notification_config_class klass.constantize.new(notification) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems