Class: Minbox::Publisher
- Inherits:
-
Object
- Object
- Minbox::Publisher
- Defined in:
- lib/minbox/publisher.rb
Constant Summary collapse
- REGISTERED_PUBLISHERS =
{ stdout: LogPublisher, redis: RedisPublisher, file: FilePublisher, }.freeze
Instance Attribute Summary collapse
-
#publishers ⇒ Object
readonly
Returns the value of attribute publishers.
Class Method Summary collapse
Instance Method Summary collapse
- #add(publisher) ⇒ Object
-
#initialize(*publishers) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish(mail) ⇒ Object
Constructor Details
#initialize(*publishers) ⇒ Publisher
Returns a new instance of Publisher.
48 49 50 |
# File 'lib/minbox/publisher.rb', line 48 def initialize(*publishers) @publishers = Array(publishers) end |
Instance Attribute Details
#publishers ⇒ Object (readonly)
Returns the value of attribute publishers.
46 47 48 |
# File 'lib/minbox/publisher.rb', line 46 def publishers @publishers end |
Class Method Details
.from(outputs) ⇒ Object
63 64 65 66 67 68 69 70 |
# 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 |
Instance Method Details
#add(publisher) ⇒ Object
52 53 54 |
# File 'lib/minbox/publisher.rb', line 52 def add(publisher) publishers << publisher end |