Class: SmartCore::Initializer::ExtensionSet Private

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

Instance Attribute Summary collapse

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.5.0



19
20
21
22
# File 'lib/smart_core/initializer/extension_set.rb', line 19

def initialize
  @extensions = []
  @access_lock = Mutex.new
end

Instance Attribute Details

#extensionsArray<SmartCore::Initializer::InitializationExtension> (readonly)

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<SmartCore::Initializer::InitializationExtension>)

Since:

  • 0.5.0



13
14
15
# File 'lib/smart_core/initializer/extension_set.rb', line 13

def extensions
  @extensions
end

Instance Method Details

#add_extension(extension) ⇒ 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:

  • extension (SmartCore::Initializer::InitializationExtension)

Since:

  • 0.5.0



29
30
31
# File 'lib/smart_core/initializer/extension_set.rb', line 29

def add_extension(extension)
  thread_safe { extensions << extension }
end

#concat(extension_set) ⇒ 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.5.0



61
62
63
# File 'lib/smart_core/initializer/extension_set.rb', line 61

def concat(extension_set)
  thread_safe { extensions.concat(extension_set.dup.extensions) }
end

#dupSmartCore::Initializer::ExtensionSet

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.5.0



38
39
40
41
42
43
44
45
46
# File 'lib/smart_core/initializer/extension_set.rb', line 38

def dup
  thread_safe do
    self.class.new.tap do |duplicate|
      extensions.each do |extension|
        duplicate.add_extension(extension.dup)
      end
    end
  end
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.

Returns:

  • (Enumerable)

Since:

  • 0.5.0



52
53
54
# File 'lib/smart_core/initializer/extension_set.rb', line 52

def each(&block)
  thread_safe { block_given? ? extensions.each(&block) : extensions.each }
end