File tree 4 files changed +25
-1
lines changed
4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 9
9
(eval . (put 'p/def-map-type 'clojure-doc-string-elt 2 ))
10
10
(eval . (put-clojure-indent 'p/defprotocol+ '(1 (:defn ))))
11
11
(eval . (put-clojure-indent 'p/def-map-type '(2 nil nil (:defn ))))
12
+ (eval . (put-clojure-indent 'p/deftype+ '(2 nil nil (:defn ))))
12
13
(eval . (put-clojure-indent 'with-meta '(:form )))
13
14
(eval . (put-clojure-indent 'with-bindings* '(:form ))))))
Original file line number Diff line number Diff line change 67
67
(Instance. model orig m new-meta)))
68
68
69
69
clojure.lang.IPersistentCollection
70
+ (cons [this o]
71
+ (cond
72
+ (map? o)
73
+ (reduce #(apply assoc %1 %2 ) this o)
74
+
75
+ (clojure.core/instance? java.util.Map o)
76
+ (reduce
77
+ #(apply assoc %1 %2 )
78
+ this
79
+ (into {} o))
80
+
81
+ :else
82
+ (if-let [[k v] (seq o)]
83
+ (assoc this k v)
84
+ this)))
85
+
70
86
(equiv [_this another]
71
87
(cond
72
88
(clojure.core/instance? toucan2.protocols.IModel another)
Original file line number Diff line number Diff line change 30
30
" The default magic map transform function. Converts things to `kebab-case`, preserving namespaces."
31
31
[k]
32
32
(when k
33
- (if (and (clojure.core/ instance? clojure.lang.Named k) (namespace k))
33
+ (if (and (instance? clojure.lang.Named k) (namespace k))
34
34
(keyword (->kebab-case (namespace k)) (->kebab-case (name k)))
35
35
(keyword (->kebab-case (name k))))))
36
36
Original file line number Diff line number Diff line change 411
411
empty-instance))
412
412
(is (instance/instance? empty-instance))
413
413
(is (instance/instance-of? ::venues empty-instance))))))
414
+
415
+ (deftest ^:parallel merge-test
416
+ (let [m (instance/instance ::birds {:name " Parroty" })]
417
+ (are [m2 expected] (= expected
418
+ (merge m m2))
419
+ {:type :parakeet } {:name " Parroty" , :type :parakeet }
420
+ nil {:name " Parroty" })))
You can’t perform that action at this time.
0 commit comments