Module: SmartCore::Types::Primitive::SumFactory Private

Defined in:
lib/smart_core/types/primitive/sum_factory.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Version:

  • 0.3.0

Defined Under Namespace

Classes: DefinitionContext

Class Method Summary collapse

Class Method Details

.create_type(types, 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:

  • types (Array<SmartCore::Types::Primtive>)
  • type_definition (NilClass, Proc)

Returns:

Since:

  • 0.1.0

Version:

  • 0.3.0



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/smart_core/types/primitive/sum_factory.rb', line 17

def create_type(types, type_definition)
  type_definitions = build_type_definitions(type_definition)
  type_runtime_attributes_checker = build_type_runtime_attributes_checker(type_definitions)
  type_validator = build_type_validator(types, type_definitions)
  type_caster = build_type_caster(types, type_definitions)
  build_type(
    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)
  end
end