class Minbox::Publisher

Constants

REGISTERED_PUBLISHERS

Attributes

publishers[R]

Public Class Methods

from(outputs) click to toggle source
# File lib/minbox/publisher.rb, line 63
def self.from(outputs)
  publisher = Publisher.new
  outputs.each do |x|
    clazz = REGISTERED_PUBLISHERS[x.to_sym]
    publisher.add(clazz.new) if clazz
  end
  publisher
end
new(*publishers) click to toggle source
# File lib/minbox/publisher.rb, line 48
def initialize(*publishers)
  @publishers = Array(publishers)
end

Public Instance Methods

add(publisher) click to toggle source
# File lib/minbox/publisher.rb, line 52
def add(publisher)
  publishers << publisher
end
publish(mail) click to toggle source
# File lib/minbox/publisher.rb, line 56
def publish(mail)
  Thread.new do
    Minbox.logger.debug("Publishing: #{mail.message_id}")
    publishers.each { |x| x.publish(mail) }
  end
end