Sha256: e2e12c3174504f5bccbb3a39e448a613cad86517f3dfc93954ee6a0fecdfbbbd

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

module Dry
  module System
    class ProviderRegistry
      include Enumerable

      attr_reader :items

      def initialize
        @items = []
      end

      def each(&block)
        items.each(&block)
      end

      def register(name, options)
        items << Provider.new(name, options)
      end

      def [](name)
        detect { |provider| provider.name == name }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-system-0.22.0 lib/dry/system/provider_registry.rb
dry-system-0.21.0 lib/dry/system/provider_registry.rb