rename option to better reflect it's purpose
This commit is contained in:
parent
b2c31e5d2c
commit
4315ddfa54
|
@ -107,7 +107,7 @@
|
|||
|
||||
(defn- make-model-map [model-map-values]
|
||||
(let [model-map-obj (new JtwigModelMap)
|
||||
values (if (:stringify-keys @options)
|
||||
values (if (:stringify-model-map-keys @options)
|
||||
(stringify-keys model-map-values)
|
||||
model-map-values)]
|
||||
(doseq [[k v] values]
|
||||
|
|
|
@ -33,4 +33,6 @@
|
|||
; whether or not to automatically stringify the keys of model-maps. Jtwig requires that all
|
||||
; the keys will be strings for model value resolution to work correctly. if you are already
|
||||
; setting your keys as maps, then you can turn this option off to save a bit on performance
|
||||
:stringify-keys true}))
|
||||
:stringify-model-map-keys true
|
||||
|
||||
}))
|
|
@ -29,16 +29,16 @@
|
|||
"Hello Bob!")
|
||||
"passing a model-map where the keys are strings already")
|
||||
(do
|
||||
(set-options! :stringify-keys false)
|
||||
(set-options! :stringify-model-map-keys false)
|
||||
|
||||
(is (= (render "Hello {{ name }}!"
|
||||
{"name" "Bob"})
|
||||
"Hello Bob!")
|
||||
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
|
||||
|
||||
(set-options! :stringify-keys true))
|
||||
(set-options! :stringify-model-map-keys true))
|
||||
(do
|
||||
(set-options! :stringify-keys false)
|
||||
(set-options! :stringify-model-map-keys false)
|
||||
|
||||
(is (thrown?
|
||||
ClassCastException
|
||||
|
@ -46,7 +46,7 @@
|
|||
{:name "Bob"}))
|
||||
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
|
||||
|
||||
(set-options! :stringify-keys true))))
|
||||
(set-options! :stringify-model-map-keys true))))
|
||||
|
||||
(deftest passing-model-map-data
|
||||
(testing "Passing Clojure data structures to JTwigContext's"
|
||||
|
@ -117,16 +117,16 @@
|
|||
"Hello Bob from a file!")
|
||||
"passing a model-map where the keys are strings already")
|
||||
(do
|
||||
(set-options! :stringify-keys false)
|
||||
(set-options! :stringify-model-map-keys false)
|
||||
|
||||
(is (= (render-file test-filename
|
||||
{"name" "Bob"})
|
||||
"Hello Bob from a file!")
|
||||
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
|
||||
|
||||
(set-options! :stringify-keys true))
|
||||
(set-options! :stringify-model-map-keys true))
|
||||
(do
|
||||
(set-options! :stringify-keys false)
|
||||
(set-options! :stringify-model-map-keys false)
|
||||
|
||||
(is (thrown?
|
||||
ClassCastException
|
||||
|
@ -134,4 +134,4 @@
|
|||
{:name "Bob"}))
|
||||
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
|
||||
|
||||
(set-options! :stringify-keys true)))))
|
||||
(set-options! :stringify-model-map-keys true)))))
|
||||
|
|
Reference in a new issue