Module: SmartCore::Container::DefinitionDSL::ClassMethods Private

Defined in:
lib/smart_core/container/definition_dsl.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#compose(container_klass) ⇒ void

This method returns an undefined value.

Parameters:

Since:

  • 0.1.0



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/smart_core/container/definition_dsl.rb', line 92

def compose(container_klass)
  @__container_definition_lock__.write_sync do
    __container_definition_commands__ << Commands::Definition::Compose.new(
      container_klass
    )

    __container_instantiation_commands__ << Commands::Instantiation::Compose.new(
      container_klass
    )
  end
end

#freeze_state!void

This method returns an undefined value.

Since:

  • 0.1.0



108
109
110
111
112
# File 'lib/smart_core/container/definition_dsl.rb', line 108

def freeze_state!
  @__container_definition_lock__.write_sync do
    __container_instantiation_commands__ << Commands::Instantiation::FreezeState.new
  end
end

#namespace(namespace_name, &dependencies_definition) ⇒ void

This method returns an undefined value.

Parameters:

  • namespace_name (String, Symbol)
  • dependencies_definition (Block)

Since:

  • 0.1.0



55
56
57
58
59
60
61
62
63
# File 'lib/smart_core/container/definition_dsl.rb', line 55

def namespace(namespace_name, &dependencies_definition)
  @__container_definition_lock__.write_sync do
    DependencyCompatability::Definition.prevent_dependency_overlap!(self, namespace_name)

    __container_definition_commands__ << Commands::Definition::Namespace.new(
      namespace_name, dependencies_definition
    )
  end
end

#register(dependency_name, memoize: SmartCore::Container::Registry::DEFAULT_MEMOIZATION_BEHAVIOR, &dependency_definition) ⇒ void

This method returns an undefined value.

Parameters:

  • dependency_name (String, Symbol)
  • dependency_definition (Block)
  • memoize (Hash) (defaults to: SmartCore::Container::Registry::DEFAULT_MEMOIZATION_BEHAVIOR)

    a customizable set of options

Options Hash (memoize:):

  • (Boolean)

Since:

  • 0.1.0

Version:

  • 0.3.0



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/smart_core/container/definition_dsl.rb', line 73

def register(
  dependency_name,
  memoize: SmartCore::Container::Registry::DEFAULT_MEMOIZATION_BEHAVIOR,
  &dependency_definition
)
  @__container_definition_lock__.write_sync do
    DependencyCompatability::Definition.prevent_namespace_overlap!(self, dependency_name)

    __container_definition_commands__ << Commands::Definition::Register.new(
      dependency_name, dependency_definition, memoize
    )
  end
end