Class: SmartCore::Container::Entities::Namespace Private

Inherits:
Base
  • Object
show all
Defined in:
lib/smart_core/container/entities/namespace.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 Attribute Summary collapse

Attributes inherited from Base

#external_name

Instance Method Summary collapse

Constructor Details

#initialize(namespace_name, host_container = SmartCore::Container::NO_HOST_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.

Parameters:

  • namespace_name (String)
  • host_container (NilClass, SmartCore::Container) (defaults to: SmartCore::Container::NO_HOST_CONTAINER)

Since:

  • 0.1.0

Version:

  • 0.10.0



26
27
28
29
30
31
32
# File 'lib/smart_core/container/entities/namespace.rb', line 26

def initialize(namespace_name, host_container = SmartCore::Container::NO_HOST_CONTAINER)
  super(namespace_name)
  @container_klass = Class.new(SmartCore::Container)
  @container_instance = nil
  @host_container = host_container
  @lock = SmartCore::Engine::ReadWriteLock.new
end

Instance Attribute Details

#host_containerNilClass, SmartCore::Container (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:

Since:

  • 0.8.01



17
18
19
# File 'lib/smart_core/container/entities/namespace.rb', line 17

def host_container
  @host_container
end

Instance Method Details

#append_definitions(dependencies_definition) ⇒ 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:

  • dependencies_definition (Proc)

Since:

  • 0.10.0



49
50
51
# File 'lib/smart_core/container/entities/namespace.rb', line 49

def append_definitions(dependencies_definition)
  @lock.write_sync { container_klass.instance_eval(&dependencies_definition) }
end

#freeze!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.

Since:

  • 0.10.0



57
58
59
# File 'lib/smart_core/container/entities/namespace.rb', line 57

def freeze!
  @lock.write_sync { container_instance.freeze! }
end

#reveal(runtime_host_container = SmartCore::Container::NO_HOST_CONTAINER) ⇒ 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.

Parameters:

  • runtime_host_container (SmartCore::Container, NilClass) (defaults to: SmartCore::Container::NO_HOST_CONTAINER)

Returns:

Since:

  • 0.1.0

Version:

  • 0.10.0



40
41
42
# File 'lib/smart_core/container/entities/namespace.rb', line 40

def reveal(runtime_host_container = SmartCore::Container::NO_HOST_CONTAINER)
  @lock.read_sync { container_instance(runtime_host_container) }
end