Class: Gcpc::Interceptors::Subscriber::DecodeInterceptor
- Inherits:
-
Subscriber::BaseInterceptor
- Object
- Subscriber::BaseInterceptor
- Gcpc::Interceptors::Subscriber::DecodeInterceptor
- Defined in:
- lib/gcpc/interceptors/subscriber/decode_interceptor.rb
Overview
‘DecodeInterceptor` decodes the message according to the strategy and sets it in the attributes.
Defined Under Namespace
Classes: BaseStrategy, JSONStrategy
Instance Method Summary collapse
- #handle(data, attributes, message, &block) {|m, attributes, message| ... } ⇒ Object
-
#initialize(strategy:) ⇒ DecodeInterceptor
constructor
A new instance of DecodeInterceptor.
Constructor Details
#initialize(strategy:) ⇒ DecodeInterceptor
Returns a new instance of DecodeInterceptor.
22 23 24 |
# File 'lib/gcpc/interceptors/subscriber/decode_interceptor.rb', line 22 def initialize(strategy:) @strategy = strategy end |
Instance Method Details
#handle(data, attributes, message, &block) {|m, attributes, message| ... } ⇒ Object
30 31 32 33 |
# File 'lib/gcpc/interceptors/subscriber/decode_interceptor.rb', line 30 def handle(data, attributes, , &block) m = @strategy.decode(data, attributes, ) yield m, attributes, end |