Class: DiFtw::Factory
- Inherits:
-
Object
- Object
- DiFtw::Factory
- Defined in:
- lib/diftw/factory.rb
Overview
A dependency that will be re-created every time it’s injected.
Instance Method Summary collapse
-
#initialize(y) ⇒ Factory
constructor
A new dependency.
-
#resolve ⇒ Object
Return the value for the dependency by calling the registration Proc.
Constructor Details
#initialize(y) ⇒ Factory
A new dependency.
11 12 13 14 |
# File 'lib/diftw/factory.rb', line 11 def initialize(y) @y = y @val = nil end |
Instance Method Details
#resolve ⇒ Object
Return the value for the dependency by calling the registration Proc.
19 20 21 |
# File 'lib/diftw/factory.rb', line 19 def resolve @y.call end |