Class: SmartCore::Initializer::TypeSystem::Registry Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/smart_core/initializer/type_system/registry.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.10.0

Instance Method Summary collapse

Constructor Details

#initializevoid

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.

Since:

  • 0.1.0

Version:

  • 0.10.0



15
16
17
18
# File 'lib/smart_core/initializer/type_system/registry.rb', line 15

def initialize
  @systems = {}
  @lock = SmartCore::Engine::ReadWriteLock.new
end

Instance Method Details

#each(&block) {|system_name, system_interop| ... } ⇒ Enumerable

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:

  • block (Block)

Yields:

  • (system_name, system_interop)

    @yieldparam system_name [String] @yieldparam system_interop [Class<SmartCore::Initializer::TypeSystem::Interop>]

Returns:

  • (Enumerable)

Since:

  • 0.1.0

Version:

  • 0.10.0



68
69
70
# File 'lib/smart_core/initializer/type_system/registry.rb', line 68

def each(&block)
  @lock.read_sync { iterate(&block) }
end

#interopsArray<Class<SmartCore::Initializer::TypeSystem::Interop>>

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:

Since:

  • 0.1.0

Version:

  • 0.10.0



55
56
57
# File 'lib/smart_core/initializer/type_system/registry.rb', line 55

def interops
  @lock.read_sync { system_interops }
end

#namesArray<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.

Returns:

  • (Array<String>)

Since:

  • 0.1.0

Version:

  • 0.10.0



46
47
48
# File 'lib/smart_core/initializer/type_system/registry.rb', line 46

def names
  @lock.read_sync { system_names }
end

#register(system_identifier, interop_klass) ⇒ 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:

Since:

  • 0.1.0

Version:

  • 0.10.0



27
28
29
# File 'lib/smart_core/initializer/type_system/registry.rb', line 27

def register(system_identifier, interop_klass)
  @lock.write_sync { apply(system_identifier, interop_klass) }
end

#resolve(system_identifier) ⇒ Class<SmartCore::Initializer::TypeSystem::Interop>

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:

  • system_identifier (String, Symbol)

Returns:

Since:

  • 0.1.0

Version:

  • 0.10.0



37
38
39
# File 'lib/smart_core/initializer/type_system/registry.rb', line 37

def resolve(system_identifier)
  @lock.read_sync { fetch(system_identifier) }
end

#to_hHash<String,Class<SmartCore::Initializer::TypeSystem::Interop>] Also known as: to_hash

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 Hash<String,Class<SmartCore::Initializer::TypeSystem::Interop>].

Returns:

Since:

  • 0.1.0

Version:

  • 0.10.0



77
78
79
# File 'lib/smart_core/initializer/type_system/registry.rb', line 77

def to_h
  @lock.write_sync { systems.dup }
end