Dependency v0.1.0 Dependency View Source
Fuctions to build soft dependencies between modules. This is useful when you want to test with diffirent situations in test mode.
The resolution is dynamic in test mode (uses Registry
). In dev and production modes, the dependency in compiled inline.
Link to this section Summary
Functions
Register an implementation for a module
Resolve the implementation for a module
Starts the dependency registry
Link to this section Functions
Register an implementation for a module.
Returns {:ok, module}
Examples
iex> Dependency.register(Foo, Bar)
Resolve the implementation for a module.
Returns module
Examples
iex> Dependency.register(Foo, Bar)
iex> Dependency.resolve(Foo) Bar
Starts the dependency registry.
This is done for you if you add :dependency
to list of apps in your mix.exs
.
Returns {:ok, pid}