Class: SmartCore::Container::DefinitionDSL::Commands::Definition::Register Private

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inheritable=, inheritable?, #inheritable?, inherited

Constructor Details

#initialize(dependency_name, dependency_definition, memoize) ⇒ 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:

  • dependency_name (String, Symbol)
  • dependency_definition (Proc)
  • memoize (Boolean)

Since:

  • 0.1.0

Version:

  • 0.2.0



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

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

Instance Attribute Details

#dependency_nameString (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



14
15
16
# File 'lib/smart_core/container/definition_dsl/commands/definition/register.rb', line 14

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.1.0

Version:

  • 0.2.0



38
39
40
# File 'lib/smart_core/container/definition_dsl/commands/definition/register.rb', line 38

def call(registry)
  registry.register_dependency(dependency_name, memoize: memoize, &dependency_definition)
end

#dupSmartCore::Container::DefinitionDSL::Commands::Definition::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.



47
48
49
# File 'lib/smart_core/container/definition_dsl/commands/definition/register.rb', line 47

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