Class: DataModel::Type
- Inherits:
-
Object
show all
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/data_model/type.rb
Constant Summary
collapse
- TArguments =
T.type_alias { T::Hash[Symbol, T.untyped] }
- TTypeParams =
T.type_alias { T::Array[Object] }
- TTypeResult =
T.type_alias { [Object, Error] }
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args, registry: TypeRegistry.instance) ⇒ Type
Returns a new instance of Type.
16
17
18
19
|
# File 'lib/data_model/type.rb', line 16
def initialize(args, registry: TypeRegistry.instance)
@type_args = args
@type_registry = registry
end
|
Instance Attribute Details
#type_args ⇒ Object
Returns the value of attribute type_args.
22
23
24
|
# File 'lib/data_model/type.rb', line 22
def type_args
@type_args
end
|
Instance Method Details
26
|
# File 'lib/data_model/type.rb', line 26
def configure(params); end
|
#instantiate(name, args: {}, params: nil) ⇒ Object
40
41
42
43
44
|
# File 'lib/data_model/type.rb', line 40
def instantiate(name, args: {}, params: nil)
t = @type_registry.type(name, args:, params:)
return t
end
|
#invoke(name, val, coerce: false, args: {}, params: nil) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/data_model/type.rb', line 30
def invoke(name, val, coerce: false, args: {}, params: nil)
t = instantiate(name, args:, params:)
result = t.read(val, coerce:)
return result
end
|
#read(data, coerce: false) ⇒ Object
48
|
# File 'lib/data_model/type.rb', line 48
def read(data, coerce: false); end
|