Class: Dry::Schema::TypeRegistry Private
- Inherits:
-
Object
- Object
- Dry::Schema::TypeRegistry
- Defined in:
- lib/dry/schema/type_registry.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A simple wrapper around Dry::Types registry
This is used internally by specialized processor sub-classes
Instance Attribute Summary collapse
- #namespace ⇒ Object readonly private
- #types ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object private
-
#initialize(types, namespace = :strict) ⇒ TypeRegistry
constructor
private
A new instance of TypeRegistry.
- #namespaced(ns) ⇒ Object private
Constructor Details
#initialize(types, namespace = :strict) ⇒ TypeRegistry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TypeRegistry.
26 27 28 29 |
# File 'lib/dry/schema/type_registry.rb', line 26 def initialize(types, namespace = :strict) @types = types @namespace = namespace end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/dry/schema/type_registry.rb', line 18 def namespace @namespace end |
#types ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/dry/schema/type_registry.rb', line 15 def types @types end |
Class Method Details
.new(types = Dry::Types, namespace = :strict) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/dry/schema/type_registry.rb', line 21 def self.new(types = Dry::Types, namespace = :strict) super end |
Instance Method Details
#[](name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 |
# File 'lib/dry/schema/type_registry.rb', line 37 def [](name) key = [namespace, name].compact.join(DOT) types.registered?(key) ? types[key] : types[name.to_s] end |
#namespaced(ns) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/dry/schema/type_registry.rb', line 32 def namespaced(ns) self.class.new(types, ns) end |