Sha256: d4da81ef33994421a2070bc7d96ff452dc57b4bba0124badc6b6fb1210a3baeb

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

module Alephant
  module Broker
    class ComponentMeta
      attr_reader :id, :options, :batch_id

      def initialize(id, batch_id, options)
        @id          = id
        @batch_id    = batch_id
        @options     = convert_keys(options || {})
      end

      def key
        batch_id.nil? ? component_key : renderer_key
      end

      def opts_hash
        Crimp.signature options
      end

      def component_key
        "#{id}/#{opts_hash}"
      end

      private

      def convert_keys(hash)
        Hash[hash.map { |k, v| [k.to_sym, v] }]
      end

      def renderer_key
        "#{batch_id}/#{opts_hash}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alephant-broker-3.14.0 lib/alephant/broker/component_meta.rb