Class: DispatchRider::Publisher::Base
- Inherits:
-
Object
- Object
- DispatchRider::Publisher::Base
- Defined in:
- lib/dispatch-rider/publisher/base.rb
Class Method Summary collapse
- .default_publisher ⇒ Object
- .destinations(destinations) ⇒ Object
- .publish(*args, &block) ⇒ Object
- .subject(subject) ⇒ Object
Instance Method Summary collapse
-
#initialize(publisher = nil) ⇒ Base
constructor
A new instance of Base.
- #publish(body) ⇒ Object
Constructor Details
#initialize(publisher = nil) ⇒ Base
Returns a new instance of Base.
24 25 26 |
# File 'lib/dispatch-rider/publisher/base.rb', line 24 def initialize(publisher = nil) @publisher = publisher end |
Class Method Details
.default_publisher ⇒ Object
14 15 16 |
# File 'lib/dispatch-rider/publisher/base.rb', line 14 def default_publisher @@default_publisher ||= DispatchRider::Publisher.new end |
.destinations(destinations) ⇒ Object
10 11 12 |
# File 'lib/dispatch-rider/publisher/base.rb', line 10 def destinations(destinations) @destinations = Array(destinations) end |
.publish(*args, &block) ⇒ Object
18 19 20 |
# File 'lib/dispatch-rider/publisher/base.rb', line 18 def publish(*args, &block) raise NotImplementedError end |
.subject(subject) ⇒ Object
6 7 8 |
# File 'lib/dispatch-rider/publisher/base.rb', line 6 def subject(subject) @subject = subject end |
Instance Method Details
#publish(body) ⇒ Object
28 29 30 |
# File 'lib/dispatch-rider/publisher/base.rb', line 28 def publish(body) publisher.publish(destinations: destinations, message: { subject: subject, body: body }) end |