Class: Dry::Component::Injector
- Inherits:
- BasicObject
- Defined in:
- lib/dry/component/injector.rb
Instance Attribute Summary collapse
- #container ⇒ Object readonly private
- #injector ⇒ Object readonly private
- #options ⇒ Object readonly private
Instance Method Summary collapse
- #[](*deps) ⇒ Object
-
#initialize(container, options: {}, strategy: :default) ⇒ Injector
constructor
private
A new instance of Injector.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(container, options: {}, strategy: :default) ⇒ Injector
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 a new instance of Injector.
16 17 18 19 20 |
# File 'lib/dry/component/injector.rb', line 16 def initialize(container, options: {}, strategy: :default) @container = container @options = @injector = ::Dry::AutoInject(container, ).__send__(strategy) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#container ⇒ Object (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.
7 8 9 |
# File 'lib/dry/component/injector.rb', line 7 def container @container end |
#injector ⇒ Object (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.
13 14 15 |
# File 'lib/dry/component/injector.rb', line 13 def injector @injector end |
#options ⇒ Object (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.
10 11 12 |
# File 'lib/dry/component/injector.rb', line 10 def @options end |
Instance Method Details
#[](*deps) ⇒ Object
23 24 25 26 |
# File 'lib/dry/component/injector.rb', line 23 def [](*deps) load_components(*deps) injector[*deps] end |
#respond_to?(name, include_private = false) ⇒ Boolean
32 33 34 |
# File 'lib/dry/component/injector.rb', line 32 def respond_to?(name, include_private = false) injector.respond_to?(name, include_private) end |