Class: Gcpc::Interceptors::Publisher::PublisherNameInterceptor
- Inherits:
-
Publisher::BaseInterceptor
- Object
- Publisher::BaseInterceptor
- Gcpc::Interceptors::Publisher::PublisherNameInterceptor
- Defined in:
- lib/gcpc/interceptors/publisher/publisher_name_interceptor.rb
Overview
‘PublisherNameInterceptor` adds a publisher name to a message’s attributes
Instance Method Summary collapse
-
#initialize(publisher:) ⇒ PublisherNameInterceptor
constructor
A new instance of PublisherNameInterceptor.
- #publish(data, attributes) {|data, a| ... } ⇒ Object
Constructor Details
#initialize(publisher:) ⇒ PublisherNameInterceptor
Returns a new instance of PublisherNameInterceptor.
8 9 10 |
# File 'lib/gcpc/interceptors/publisher/publisher_name_interceptor.rb', line 8 def initialize(publisher:) @publisher = publisher end |
Instance Method Details
#publish(data, attributes) {|data, a| ... } ⇒ Object
14 15 16 17 |
# File 'lib/gcpc/interceptors/publisher/publisher_name_interceptor.rb', line 14 def publish(data, attributes) a = attributes.merge("published_by" => @publisher) yield data, a end |