Class: Dry::AutoInject
- Inherits:
-
Object
- Object
- Dry::AutoInject
- Defined in:
- lib/dry/auto_inject.rb,
lib/dry/auto_inject/version.rb
Overview
Main DSL class
Constant Summary collapse
- VERSION =
'0.0.1'.freeze
Instance Attribute Summary collapse
- #injection ⇒ Object readonly private
Class Method Summary collapse
-
.new(&block) ⇒ Dry::AutoInject::Injection
Configure an auto-injection module.
Instance Method Summary collapse
-
#container(container) ⇒ Object
Set up the container for the injection module.
-
#initialize(&block) ⇒ AutoInject
constructor
private
A new instance of AutoInject.
Constructor Details
#initialize(&block) ⇒ AutoInject
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 AutoInject.
51 52 53 54 |
# File 'lib/dry/auto_inject.rb', line 51 def initialize(&block) instance_exec(&block) @injection = -> *names { Injection.new(names, @container) } end |
Instance Attribute Details
#injection ⇒ 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.
12 13 14 |
# File 'lib/dry/auto_inject.rb', line 12 def injection @injection end |
Class Method Details
.new(&block) ⇒ Dry::AutoInject::Injection
Configure an auto-injection module
45 46 47 48 |
# File 'lib/dry/auto_inject.rb', line 45 def self.new(&block) dsl = super(&block) dsl.injection end |
Instance Method Details
#container(container) ⇒ Object
Set up the container for the injection module
59 60 61 |
# File 'lib/dry/auto_inject.rb', line 59 def container(container) @container = container end |