Class: SmartCore::Injection::Injector::ContainerSet Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/smart_core/injection/injector/container_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.1.0

Defined Under Namespace

Classes: AddingListener

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



15
16
17
18
19
# File 'lib/smart_core/injection/injector/container_set.rb', line 15

def initialize
  @containers = [] # NOTE: we use Array cuz we need an ordered set
  @adding_listeners = []
  @access_lock = SmartCore::Engine::Lock.new
end

Instance Method Details

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

  • container (SmartCore::Container)

Since:

  • 0.1.0



26
27
28
# File 'lib/smart_core/injection/injector/container_set.rb', line 26

def add(container)
  thread_safe { append_container(container) }
end

#each(&block) {|container| ... } ⇒ Enumerator

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:

  • (container)

Yield Parameters:

  • container (SmartCore::Container)

Returns:

  • (Enumerator)

Since:

  • 0.1.0



49
50
51
# File 'lib/smart_core/injection/injector/container_set.rb', line 49

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

#listArray<SmartCore::Container>

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::Container>)

Since:

  • 0.1.0



68
69
70
# File 'lib/smart_core/injection/injector/container_set.rb', line 68

def list
  thread_safe { containers.dup }
end

#listen_addings(&listener) {|container| ... } ⇒ 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:

  • listener (Block)

Yields:

  • (container)

Yield Parameters:

  • container (SmartCore::Container)

Since:

  • 0.1.0



38
39
40
# File 'lib/smart_core/injection/injector/container_set.rb', line 38

def listen_addings(&listener)
  thread_safe { add_adding_listener(listener) }
end

#reverse_each(&block) {|container| ... } ⇒ Enumerator

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:

  • (container)

Yield Parameters:

  • container (SmartCore::Container)

Returns:

  • (Enumerator)

Since:

  • 0.1.0



60
61
62
# File 'lib/smart_core/injection/injector/container_set.rb', line 60

def reverse_each(&block)
  thread_safe { block_given? ? containers.reverse_each(&block) : containers.reverse_each }
end