Sha256: 4c070bff6b34cc793966305649bc1425a012f52eb379310afe1c8a7daed9efb3
Contents?: true
Size: 867 Bytes
Versions: 3
Compression:
Stored size: 867 Bytes
Contents
# frozen_string_literal: true module Dry module Types # Internal container for constructor functions used by the built-in types # # @api private class FnContainer # @api private def self.container @container ||= Container.new end # @api private def self.register(function = ::Dry::Core::Constants::Undefined, &block) fn = ::Dry::Core::Constants::Undefined.default(function, block) fn_name = register_name(fn) container.register(fn_name, fn) unless container.key?(fn_name) fn_name end # @api private def self.[](fn_name) if container.key?(fn_name) container[fn_name] else fn_name end end # @api private def self.register_name(function) "fn_#{function.__id__}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-types-1.8.2 | lib/dry/types/fn_container.rb |
dry-types-1.8.1 | lib/dry/types/fn_container.rb |
dry-types-1.8.0 | lib/dry/types/fn_container.rb |