Sha256: d28e1ca3eabdac074bfa6fffc2027fc5ff4ffca770b068ba56bae9bd2dc6270d

Contents?: true

Size: 660 Bytes

Versions: 25

Compression:

Stored size: 660 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

25 entries across 25 versions & 1 rubygems

Version Path
alephant-broker-3.13.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.12.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.11.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.10.2 lib/alephant/broker/component_meta.rb
alephant-broker-3.10.1 lib/alephant/broker/component_meta.rb
alephant-broker-3.10.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.9.2 lib/alephant/broker/component_meta.rb
alephant-broker-3.9.1 lib/alephant/broker/component_meta.rb
alephant-broker-3.9.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.8.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.7.1 lib/alephant/broker/component_meta.rb
alephant-broker-3.7.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.6.1 lib/alephant/broker/component_meta.rb
alephant-broker-3.6.0 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.5 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.4 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.3 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.2 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.1 lib/alephant/broker/component_meta.rb
alephant-broker-3.5.0 lib/alephant/broker/component_meta.rb