Class: SmartCore::Container::Commands::Register Private

Inherits:
Base
  • Object
show all
Defined in:
lib/smart_core/container/commands/register.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

#initialize(dependency_name, dependency_definition, **options) ⇒ 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.

TODO:

option list

Parameters:

  • dependency_name (String, Symbol)
  • options (Hash<Symbol,Any>)
  • dependency_definition (Proc)
  • memoize (Hash)

    a customizable set of options

See Also:

  • SmartCore::Container::Commands::Register.[SmartCore[SmartCore::Container[SmartCore::Container::KeyGuard]

Since:

  • 0.5.0



24
25
26
27
28
29
30
# File 'lib/smart_core/container/commands/register.rb', line 24

def initialize(dependency_name, dependency_definition, **options)
  SmartCore::Container::KeyGuard.indifferently_accessable_key(dependency_name).tap do |name|
    @dependency_name = name
    @options = options
    @dependency_definition = dependency_definition
  end
end

Instance Attribute Details

#dependency_nameString, Symbol (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, Symbol)

Since:

  • 0.5.0



11
12
13
# File 'lib/smart_core/container/commands/register.rb', line 11

def dependency_name
  @dependency_name
end

Instance Method Details

#call(registry) ⇒ 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



37
38
39
# File 'lib/smart_core/container/commands/register.rb', line 37

def call(registry)
  registry.register(dependency_name, **options, &dependency_definition)
end

#dupSmartCore::Container::Commands::Register

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.



45
46
47
# File 'lib/smart_core/container/commands/register.rb', line 45

def dup
  self.class.new(dependency_name, dependency_definition, **options)
end