Sha256: ddfbc767ac817dcb6557dce0e93e83fcda87099680142853c2294a6c20c20fe8

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require 'rom/factory/constants'

module ROM
  module Factory
    # @api private
    class Registry
      # @!attribute [r] elements
      #   @return [Hash] a hash with factory builders
      attr_reader :elements

      # @api private
      def initialize
        @elements = {}
      end

      # @api private
      def key?(name)
        elements.key?(name)
      end

      # @api private
      def []=(name, builder)
        elements[name] = builder
      end

      # @api private
      def [](name)
        elements.fetch(name) do
          raise FactoryNotDefinedError.new(name)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-factory-0.10.2 lib/rom/factory/registry.rb
rom-factory-0.10.1 lib/rom/factory/registry.rb
rom-factory-0.10.0 lib/rom/factory/registry.rb
rom-factory-0.9.1 lib/rom/factory/registry.rb
rom-factory-0.9.0 lib/rom/factory/registry.rb
rom-factory-0.8.0 lib/rom/factory/registry.rb