Class: SmartCore::Initializer::TypeSystem::SmartTypes::AbstractFactory Private

Inherits:
Interop::AbstractFactory show all
Defined in:
lib/smart_core/initializer/type_system/smart_types/abstract_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

Class Method Summary collapse

Methods inherited from Interop::AbstractFactory

create

Class Method Details

.build_cast_operation(type) ⇒ SmartCore::Initializer::TypeSystem::SmartTypes::Operation::Cast

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:

  • type (SmartCore::Types::Primitive)

Returns:

Since:

  • 0.1.0



65
66
67
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 65

def build_cast_operation(type)
  SmartTypes::Operation::Cast.new(type)
end

.build_identifier(type) ⇒ String

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:

  • type (Any)

Returns:

  • (String)

Since:

  • 0.5.1



30
31
32
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 30

def build_identifier(type)
  type.name
end

.build_interop(identifier, valid_op, validate_op, cast_op) ⇒ SmartCore::Initializer::TypeSystem::SmartTypes

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.



78
79
80
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 78

def build_interop(identifier, valid_op, validate_op, cast_op)
  SmartTypes.new(identifier, valid_op, validate_op, cast_op)
end

.build_valid_operation(type) ⇒ SmartCore::Initializer::TypeSystem::SmartTypes::Operation::Valid

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:

  • type (SmartCore::Types::Primitive)

Returns:

Since:

  • 0.1.0



39
40
41
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 39

def build_valid_operation(type)
  SmartTypes::Operation::Valid.new(type)
end

.build_validate_operation(type) ⇒ SmartCore::Initializer::TypeSystem::SmartTypes::Operation::Validate

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:

  • type (SmartCore::Types::Primitive)

Returns:

Since:

  • 0.1.0



56
57
58
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 56

def build_validate_operation(type)
  SmartTypes::Operation::Validate.new(type)
end

.generic_type_objectSmartCore::Types::Value::Any

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:

  • (SmartCore::Types::Value::Any)

Since:

  • 0.1.0



47
48
49
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 47

def generic_type_object
  SmartCore::Types::Value::Any
end

.prevent_incompatible_type!(type) ⇒ void

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.

This method returns an undefined value.

Parameters:

  • type (SmartCore::Types::Primitive)

Raises:

Since:

  • 0.1.0



15
16
17
18
19
20
21
22
23
# File 'lib/smart_core/initializer/type_system/smart_types/abstract_factory.rb', line 15

def prevent_incompatible_type!(type)
  unless type.is_a?(SmartCore::Types::Primitive)
    raise(
      SmartCore::Initializer::IncorrectTypeObjectError,
      'Incorrect SmartCore::Types primitive ' \
      '(type object should be a type of SmartCore::Types::Primitive)'
    )
  end
end