Class: SmartCore::Injection::Locator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/injection/locator.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.3.0

Defined Under Namespace

Modules: Factory Classes: ContainerProxy, Dependency

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(import_path, container_proxy, memoize_dependency:) ⇒ 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:

Options Hash (memoize_dependency:):

  • (Boolean)

Since:

  • 0.1.0

Version:

  • 0.3.0



25
26
27
28
29
30
# File 'lib/smart_core/injection/locator.rb', line 25

def initialize(import_path, container_proxy, memoize_dependency:)
  @import_path = import_path
  @container_proxy = container_proxy
  @memoize_dependency = memoize_dependency
  @dependency = SmartCore::Injection::Locator::Dependency.new(memoize: memoize_dependency)
end

Instance Attribute Details

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

  • (String)

Since:

  • 0.1.0



15
16
17
# File 'lib/smart_core/injection/locator.rb', line 15

def import_path
  @import_path
end

Instance Method Details

#rebind_dependencyAny Also known as: rebind!

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:

  • (Any)

Since:

  • 0.1.0



45
46
47
# File 'lib/smart_core/injection/locator.rb', line 45

def rebind_dependency
  dependency.rebind { container_proxy.resolve_dependency(import_path) }
end

#resolve_dependencyAny Also known as: bind!

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:

  • (Any)

Since:

  • 0.1.0



36
37
38
# File 'lib/smart_core/injection/locator.rb', line 36

def resolve_dependency
  dependency.bind { container_proxy.resolve_dependency(import_path) }
end