Class: SmartCore::Types::Primitive::Factory Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/types/primitive/factory.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.

Since:

  • 0.1.0

Version:

  • 0.3.0

Defined Under Namespace

Modules: RuntimeTypeBuilder Classes: DefinitionContext

Class Method Summary collapse

Class Method Details

.create_type(type_category, type_name, type_definition) ⇒ SmartCore::Types::Primitive

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.

Parameters:

Returns:

Since:

  • 0.1.0

Version:

  • 0.3.0



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/smart_core/types/primitive/factory.rb', line 19

def create_type(type_category, type_name, type_definition)
  type_definitions = build_type_definitions(type_definition)
  type_runtime_attributes_checker = build_type_runtime_attributes_checker(type_definitions)
  type_checker = build_type_checker(type_definitions)
  type_caster = build_type_caster(type_definitions)
  type_invariant_control = build_type_invariant_control(type_definitions)
  type_validator = build_type_validator(type_checker, type_invariant_control)
  build_type(
    type_category,
    type_name,
    type_validator,
    type_caster,
    type_runtime_attributes_checker
  ).tap do |type|
    assign_type_validator(type, type_validator)
    assign_type_runtime_attributes_checker(type, type_runtime_attributes_checker)
    register_new_type(type_category, type_name, type)
    register_runtime_type_builder(type_category, type_name)
  end
end