tools: fix thaw arg destructuring & opt merging

This commit is contained in:
Peter Taoussanis 2013-11-05 18:01:40 +07:00
parent a7e9f98d44
commit 7e7975910a
2 changed files with 4 additions and 4 deletions

View file

@ -37,8 +37,8 @@
"Like `nippy/thaw` but takes options from *thaw-opts* binding, and wraps
encrypted bytes for easy identification when no password has been provided
for decryption."
[ba & {:keys [default-opts]}]
(let [result (nippy/thaw ba (merge (or *thaw-opts* default-opts)
[ba & [{:keys [default-opts]}]]
(let [result (nippy/thaw ba (merge default-opts *thaw-opts*
{:taoensso.nippy/tools-thaw? true}))]
(if (= result :taoensso.nippy/need-password)
(EncryptedFrozen. ba)
@ -46,4 +46,4 @@
(comment (thaw (nippy/freeze "c" {:password [:cached "p"]}))
(with-thaw-opts {:password [:cached "p"]}
(thaw (nippy/freeze "c" {:password [:cached "p"]}))))
(thaw (nippy/freeze "c" {:password [:cached "p"]}))))

View file

@ -92,4 +92,4 @@
(comment (String. (ba-concat (.getBytes "foo") (.getBytes "bar")))
(let [[x y] (ba-split (.getBytes "foobar") 5)]
[(String. x) (String. y)]))
[(String. x) (String. y)]))