Class: SmartCore::Injection::Injector::InjectionSettings Private

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

Defined Under Namespace

Modules: IncompatabilityControl

Constant Summary collapse

DEFAULT_IMPORTS =

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

Returns:

  • (Hash<String|Symbol,String>)

Since:

  • 0.1.0

{}.freeze
DEFAULT_ACCESS =

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

Returns:

  • (Symbol)

Since:

  • 0.1.0

:public
ACCESS_MARKS =

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

Returns:

  • (Array<Symbol>)

Since:

  • 0.1.0

%i[public protected private].freeze
DEFAULT_BINDING_STRATEGY =

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

Returns:

  • (Symbol)

Since:

  • 0.1.0

:dynamic
BINDING_STRATEGIES =

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

Returns:

  • (Array<Symbol>)

Since:

  • 0.1.0

%i[static dynamic].freeze
DEFAULT_MEMOIZE =

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

Returns:

  • (Boolean)

Since:

  • 0.1.0

false
EMPTY_CONTAINER_DESTINATION =

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

Returns:

  • (NilClass)

Since:

  • 0.1.0

nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(injectable, container_set, imports, memoize: DEFAULT_MEMOIZE, access: DEFAULT_ACCESS, bind: DEFAULT_BINDING_STRATEGY, from: EMPTY_CONTAINER_DESTINATION) ⇒ 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:

  • injectable (Class, Module)
  • container_set (SmartCore::Injection::Injector::ContainerSet)
  • import (Hash<String|Symbol,String>)
  • memoize (Hash) (defaults to: DEFAULT_MEMOIZE)

    a customizable set of options

  • access (Hash) (defaults to: DEFAULT_ACCESS)

    a customizable set of options

  • bind (Hash) (defaults to: DEFAULT_BINDING_STRATEGY)

    a customizable set of options

  • from (Hash) (defaults to: EMPTY_CONTAINER_DESTINATION)

    a customizable set of options

Options Hash (memoize:):

  • (Boolean)

Options Hash (access:):

  • (Symbol)

Options Hash (bind:):

  • (Symbol)

Options Hash (from:):

  • (NilClass, SmartCore::Container)

Since:

  • 0.1.0



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 103

def initialize(
  injectable,
  container_set,
  imports,
  memoize: DEFAULT_MEMOIZE,
  access: DEFAULT_ACCESS,
  bind: DEFAULT_BINDING_STRATEGY,
  from: EMPTY_CONTAINER_DESTINATION
)
  IncompatabilityControl.prevent_incompatabilities!(
    injectable,
    imports,
    memoize,
    access,
    bind,
    from
  )

  @injectable = injectable
  @container_set = container_set
  @imports = imports
  @memoize = memoize
  @access = access
  @bind = bind
  @from = from
end

Instance Attribute Details

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

  • (Symbol)

Since:

  • 0.1.0



60
61
62
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 60

def access
  @access
end

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

  • (Symbol)

Since:

  • 0.1.0



66
67
68
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 66

def bind
  @bind
end

#container_setSmartCore::Injection::Injector::ContainerSet (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.



84
85
86
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 84

def container_set
  @container_set
end

#fromNilClass, <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:

  • (NilClass, <SmartCore::Container>)

Since:

  • 0.1.0



72
73
74
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 72

def from
  @from
end

#importsHash<String|Symbol,String> (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:

  • (Hash<String|Symbol,String>)

Since:

  • 0.1.0



54
55
56
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 54

def imports
  @imports
end

#injectableClass, Module (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:

  • (Class, Module)

Since:

  • 0.1.0



90
91
92
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 90

def injectable
  @injectable
end

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

  • (Boolean)

Since:

  • 0.1.0



78
79
80
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 78

def memoize
  @memoize
end

Instance Method Details

#bind_dynamic?Boolean

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:

  • (Boolean)

Since:

  • 0.1.0



150
151
152
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 150

def bind_dynamic?
  bind == :dynamic
end

#bind_static?Boolean

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:

  • (Boolean)

Since:

  • 0.1.0



158
159
160
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 158

def bind_static?
  bind == :static
end

#class_level_injectableClass

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:

  • (Class)

Since:

  • 0.1.0



142
143
144
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 142

def class_level_injectable
  class << injectable; self; end
end

#each_import(&block) {|import_key, import_path| ... } ⇒ Enumerable

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:

  • block (Block)

Yields:

  • (import_key, import_path)

Yield Parameters:

  • import_key (String, Symbol)
  • import_path (String)

Returns:

  • (Enumerable)

Since:

  • 0.1.0



170
171
172
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 170

def each_import(&block)
  block_given? ? imports.each_pair(&block) : imports.each_pair
end

#instance_level_injectableClass, Module

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:

  • (Class, Module)

Since:

  • 0.1.0



134
135
136
# File 'lib/smart_core/injection/injector/injection_settings.rb', line 134

def instance_level_injectable
  injectable
end