Class: SmartCore::Initializer::Plugins::Registry Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/smart_core/initializer/plugins/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/plugins/registry.rb', line 15

def initialize
  @plugin_set = {}
  @access_lock = SmartCore::Engine::ReadWriteLock.new
end

Instance Method Details

#[](plugin_name) ⇒ SmartCore::Initializer::Plugins::Abstract

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:

  • plugin_name (Symbol, String)

Returns:

Since:

  • 0.1.0

Version:

  • 0.10.0



26
27
28
# File 'lib/smart_core/initializer/plugins/registry.rb', line 26

def [](plugin_name)
  @access_lock.read_sync { fetch(plugin_name) }
end

#each(&block) ⇒ 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)

Returns:

  • (Enumerable)

Since:

  • 0.1.0

Version:

  • 0.10.0



66
67
68
# File 'lib/smart_core/initializer/plugins/registry.rb', line 66

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

#loadedHash<String,Class<SmartCore::Initializer::Plugins::Abstract>>

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



56
57
58
# File 'lib/smart_core/initializer/plugins/registry.rb', line 56

def loaded
  @access_lock.read_sync { loaded_plugins }
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



47
48
49
# File 'lib/smart_core/initializer/plugins/registry.rb', line 47

def names
  @access_lock.read_sync { plugin_names }
end

#register(plugin_name, plugin_module) ⇒ void Also known as: []=

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



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

def register(plugin_name, plugin_module)
  @access_lock.write_sync { apply(plugin_name, plugin_module) }
end