View Source Patch.Mock.Code.Freezer (patch v0.14.0)

The Code Freezer is a registry that can be used to register and use modules that might be frozen.

Modules that Patch relies on must be freezable so that the end-user can Patch them and the frozen versions are still available for internal use.

Link to this section Summary

Functions

Destroy all frozen modules

Get the possibly-frozen module to use for a module.

Puts a module into the freezer.

Link to this section Functions

@spec empty() :: :ok

Destroy all frozen modules

@spec get(module :: module()) :: module()

Get the possibly-frozen module to use for a module.

If the module is frozen then the frozen name will be returned.

If the module is not frozen then the module is returned.s

@spec put(module :: module()) :: :ok

Puts a module into the freezer.

The module must be freezable. Repeated calls for frozen modules are no-ops.