Sha256: 2052c67e1c543e471e192dbdf77fea0b346e3c8954cf5b2acb88f4596f06c3da

Contents?: true

Size: 600 Bytes

Versions: 14

Compression:

Stored size: 600 Bytes

Contents

# encoding: utf-8

module Punchblock
  class Client
    class ComponentRegistry
      def initialize
        @mutex = Mutex.new
        @components = Hash.new
      end

      def <<(component)
        @mutex.synchronize do
          @components[component.component_id] = component
        end
      end

      def find_by_id(component_id)
        @mutex.synchronize do
          @components[component_id]
        end
      end

      def delete(component)
        @mutex.synchronize do
          id = @components.key component
          @components.delete id
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
punchblock-2.0.1 lib/punchblock/client/component_registry.rb
punchblock-2.0.0 lib/punchblock/client/component_registry.rb
punchblock-2.0.0.beta2 lib/punchblock/client/component_registry.rb
punchblock-2.0.0.beta1 lib/punchblock/client/component_registry.rb
punchblock-1.9.4 lib/punchblock/client/component_registry.rb
punchblock-1.9.3 lib/punchblock/client/component_registry.rb
punchblock-1.9.2 lib/punchblock/client/component_registry.rb
punchblock-1.9.1 lib/punchblock/client/component_registry.rb
punchblock-1.9.0 lib/punchblock/client/component_registry.rb
punchblock-1.8.2 lib/punchblock/client/component_registry.rb
punchblock-1.8.1 lib/punchblock/client/component_registry.rb
punchblock-1.8.0 lib/punchblock/client/component_registry.rb
punchblock-1.7.1 lib/punchblock/client/component_registry.rb
punchblock-1.7.0 lib/punchblock/client/component_registry.rb