class SmartCore::Initializer::TypeSystem::ThyTypes::AbstractFactory

@api private @since 0.1.0

Constants

GENERIC_TYPE

@return [Thy::Type]

@api private @since 0.1.0

Public Class Methods

build_cast_operation(type) click to toggle source

@param type [Thy::Type, check] @return [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Cast]

@api private @since 0.1.0

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 71
def build_cast_operation(type)
  ThyTypes::Operation::Cast.new(type)
end
build_identifier(type) click to toggle source

@param type [Any] @return [String]

@api private @since 0.5.1

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 36
def build_identifier(type)
  type.name
end
build_interop(identifier, valid_op, validate_op, cast_op) click to toggle source

@param identifier [String] @param valid_op [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Valid] @param valid_op [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Validate] @param valid_op [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Cast] @return [SmartCore::Initializer::TypeSystem::ThyTypes]

@api private @since 0.1.0 @version 0.5.1

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 84
def build_interop(identifier, valid_op, validate_op, cast_op)
  ThyTypes.new(identifier, valid_op, validate_op, cast_op)
end
build_valid_operation(type) click to toggle source

@param type [Thy::Type, check] @return [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Valid]

@api private @since 0.1.0

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 45
def build_valid_operation(type)
  ThyTypes::Operation::Valid.new(type)
end
build_validate_operation(type) click to toggle source

@param type [Thy::Type, check] @return [SmartCore::Initializer::TypeSystem::ThyTypes::Operation::Validate]

@api private @since 0.1.0

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 62
def build_validate_operation(type)
  ThyTypes::Operation::Validate.new(type)
end
generic_type_object() click to toggle source

@return [Thy::Type, check]

@api private @since 0.1.0

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 53
def generic_type_object
  GENERIC_TYPE
end
prevent_incompatible_type!(type) click to toggle source

@param type [Thy::Type, check] @return [void]

@raise [SmartCore::Initializer::IncorrectTypeObjectError]

@api private @since 0.1.0

# File lib/smart_core/initializer/plugins/thy_types/thy_types/abstract_factory.rb, line 21
def prevent_incompatible_type!(type)
  unless type.respond_to?(:check) || type.is_a?(::Thy::Type)
    raise(
      SmartCore::Initializer::IncorrectTypeObjectError,
      'Incorrect Thy::Type primitive ' \
      '(type object should respond to :check method)'
    )
  end
end