`prep` does not work
hin522 opened this issue ยท 4 comments
hin522 commented
The prep
function does not call the method defmethod ig/prep-key
. An example below shows using integrant.core/prep
works as expected whereas using integrant.repl/prep
does not.
(def config {:greeting "Hello world"})
(defmethod ig/prep-key :greeting [_ opts]
"Hello world new")
(defmethod ig/init-key :greeting [_ opts]
(prn opts))
Use integrant
(require '[integrant.core :as ig])
(-> config
ig/prep
ig/init)
=> "Hello world new"
Use integrant.repl
(require '[integrant.repl :refer [prep init]])
(integrant.repl/set-prep! (constantly config))
(prep)
(init)
=> "Hello world"
weavejester commented
The README Integrant-REPL needs to be updated, as it pre-dates the introduction of the ig/prep
function. The set-prep!
function should now include ig/prep
:
(integrant.repl/set-prep! #(ig/prep config))
I'll update the README tonight or tomorrow.
hin522 commented
Thanks, it works as expected.
m1nhtu99-hoan9 commented
@weavejester Sorry for being annoying, but your "tonight or tomorrow" still did not happen yet ๐ It took me 1 hour to figure the same issue out by myself.
@Joeyjoejoe #24 seems good to me. Thank you.
weavejester commented
Fixed (at last!)