class HardWire::Root::Scope

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String) #

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


def finalize #

def name : String #

def resolve(target : Class, tag = "default") #

Resolve a dependency from the represented scope