Class: SmartCore::Initializer::Extensions::List Private

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

def initialize
  @extensions = []
  @lock = SmartCore::Engine::ReadWriteLock.new
end

Instance Method Details

#add(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:

Since:

  • 0.1.0

Version:

  • 0.10.0



26
27
28
# File 'lib/smart_core/initializer/extensions/list.rb', line 26

def add(extension)
  @lock.write_sync { extensions << extension }
end

#concat(list) ⇒ 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



37
38
39
40
41
# File 'lib/smart_core/initializer/extensions/list.rb', line 37

def concat(list)
  @lock.write_sync do
    list.each { |extension| add(extension.dup) }
  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.

Parameters:

  • block (Block)

Returns:

  • (Enumerable)

Since:

  • 0.1.0

Version:

  • 0.10.0



49
50
51
52
53
# File 'lib/smart_core/initializer/extensions/list.rb', line 49

def each(&block)
  @lock.read_sync do
    block_given? ? extensions.each(&block) : extensions.each
  end
end

#sizeInteger

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:

  • (Integer)

Since:

  • 0.1.0

Version:

  • 0.10.0



60
61
62
# File 'lib/smart_core/initializer/extensions/list.rb', line 60

def size
  @lock.read_sync { extensions.size }
end