Sha256: 1f57ce67e43145b0528f83b3f7b3f916c76db47ae712a50f03404354b17692bf

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Extensions
    # Extension for rebuilding params from a hash
    module ParamsBuilder
      # Builds params from a hash
      # @param hash [Hash] hash with params details
      # @param topic [Karafka::Routing::Topic] topic for which we build the params
      # @return [Karafka::Params::Params] built params
      def from_hash(hash, topic)
        Karafka::Params::Params
          .new
          .merge!(hash)
          .merge!('deserializer' => topic.deserializer)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
karafka-sidekiq-backend-1.3.1 lib/karafka/extensions/params_builder.rb
karafka-sidekiq-backend-1.3.0 lib/karafka/extensions/params_builder.rb
karafka-sidekiq-backend-1.3.0.rc1 lib/karafka/extensions/params_builder.rb