class HardWire::Root::Scope
- HardWire::Root::Scope
- Reference
- Object
Overview
A Scope is an object that represents the a scope's lifecycle
It is a a helper class for accessing scoped resolution and providing a lifecycle hook to destroy/garbage collect the scoped instances
Scopes work in exactly the same way that singleton lifecycles do, except that the user has control over when the instances stored inside are released for garbage collection.
NOTE you should not construct these directly, instead prefering to use the .scope
macro on the container module
Defined in:
hardwire.crConstructors
Instance Method Summary
-
#destroy
Destroy the represented scope and release the instances for garbage collection
- #finalize
- #name : String
-
#resolve(target : Class, tag = "default")
Resolve a dependency from the represented scope
Constructor Detail
Instance Method Detail
def destroy
#
Destroy the represented scope and release the instances for garbage collection
NOTE this will be called when the scope itself is garbage-collected