Skip to content

Commit

Permalink
add docstring for the ns-publics fn
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Jul 2, 2024
1 parent 2067e75 commit 778e6a9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/darkleaf/di/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,22 @@
(and (bound? var)
(some? @var)))

(defn ns-publics []
(defn ns-publics
"A registry middleware that interprets a whole namespace as a component.
A component will be a map of var names to corresponding components.
The key of a component is a keyword with the namespace `:ns-publics`
and a name containing the name of a target ns.
For example `:ns-publics/io.gihub.my.ns`.
This is useful for testing to access for all public components.
See the test darkleaf.di.tutorial.x-ns-publics-test.
```clojure
(di/start :ns-publics/io.gihub.my.ns (di/ns-publics))
```"
[]
(fn [registry]
(fn [key]
(if (and (qualified-keyword? key)
Expand Down

0 comments on commit 778e6a9

Please sign in to comment.