lib/deimos/kafka_message.rb in deimos-ruby-1.22.4 vs lib/deimos/kafka_message.rb in deimos-ruby-1.22.5

- old
+ new

@@ -37,14 +37,15 @@ # @param messages [Array<Deimos::KafkaMessage>] # @return [Array<Hash>] def self.decoded(messages=[]) return [] if messages.empty? - decoder = self.decoder(messages.first.topic)&.new + decoder_class = self.decoder(messages.first.topic) + decoder = decoder_class&.new messages.map do |m| { key: m.key.present? ? decoder&.decode_key(m.key) || m.key : nil, - payload: decoder&.decoder&.decode(m.message) || m.message + payload: decoder_class&.decoder&.decode(m.message) || m.message } end end # @return [Hash]