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]
|
(defn- make-model-map [model-map-values]
|
||||||
(let [model-map-obj (new JtwigModelMap)
|
(let [model-map-obj (new JtwigModelMap)
|
||||||
values (if (:stringify-keys @options)
|
values (if (:stringify-model-map-keys @options)
|
||||||
(stringify-keys model-map-values)
|
(stringify-keys model-map-values)
|
||||||
model-map-values)]
|
model-map-values)]
|
||||||
(doseq [[k v] values]
|
(doseq [[k v] values]
|
||||||
|
|
|
@ -33,4 +33,6 @@
|
||||||
; whether or not to automatically stringify the keys of model-maps. Jtwig requires that all
|
; 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
|
; 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
|
; 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!")
|
"Hello Bob!")
|
||||||
"passing a model-map where the keys are strings already")
|
"passing a model-map where the keys are strings already")
|
||||||
(do
|
(do
|
||||||
(set-options! :stringify-keys false)
|
(set-options! :stringify-model-map-keys false)
|
||||||
|
|
||||||
(is (= (render "Hello {{ name }}!"
|
(is (= (render "Hello {{ name }}!"
|
||||||
{"name" "Bob"})
|
{"name" "Bob"})
|
||||||
"Hello Bob!")
|
"Hello Bob!")
|
||||||
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
|
"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
|
(do
|
||||||
(set-options! :stringify-keys false)
|
(set-options! :stringify-model-map-keys false)
|
||||||
|
|
||||||
(is (thrown?
|
(is (thrown?
|
||||||
ClassCastException
|
ClassCastException
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
{:name "Bob"}))
|
{:name "Bob"}))
|
||||||
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
|
"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
|
(deftest passing-model-map-data
|
||||||
(testing "Passing Clojure data structures to JTwigContext's"
|
(testing "Passing Clojure data structures to JTwigContext's"
|
||||||
|
@ -117,16 +117,16 @@
|
||||||
"Hello Bob from a file!")
|
"Hello Bob from a file!")
|
||||||
"passing a model-map where the keys are strings already")
|
"passing a model-map where the keys are strings already")
|
||||||
(do
|
(do
|
||||||
(set-options! :stringify-keys false)
|
(set-options! :stringify-model-map-keys false)
|
||||||
|
|
||||||
(is (= (render-file test-filename
|
(is (= (render-file test-filename
|
||||||
{"name" "Bob"})
|
{"name" "Bob"})
|
||||||
"Hello Bob from a file!")
|
"Hello Bob from a file!")
|
||||||
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
|
"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
|
(do
|
||||||
(set-options! :stringify-keys false)
|
(set-options! :stringify-model-map-keys false)
|
||||||
|
|
||||||
(is (thrown?
|
(is (thrown?
|
||||||
ClassCastException
|
ClassCastException
|
||||||
|
@ -134,4 +134,4 @@
|
||||||
{:name "Bob"}))
|
{:name "Bob"}))
|
||||||
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
|
"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