Permalink
Browse files

Remove some code that duplicated clojure.core fns

  • Loading branch information...
1 parent d3487d6 commit 885e7378be73bec2552f479a0b9ee41d3f498a2b @duelinmarkers committed Jan 8, 2012
Showing with 2 additions and 24 deletions.
  1. +2 −11 src/clj_record/serialization.clj
  2. +0 −13 test/clj_record/serialization_test.clj
@@ -3,18 +3,9 @@
[clj-record.callbacks.built-ins :as callb]))
-(defn serialize [value]
- (binding [*out* (java.io.StringWriter.)]
- (pr value)
- (.toString *out*)))
-
-(defn deserialize [value]
- (when value
- (read (java.io.PushbackReader. (java.io.StringReader. value)))))
-
(defn serialize-attribute [model-name attribute]
- (callbacks/add-callback model-name :before-save (callb/transform-value attribute serialize))
- (callbacks/add-callback model-name :after-load (callb/transform-value attribute deserialize)))
+ (callbacks/add-callback model-name :before-save (callb/transform-value attribute pr-str))
+ (callbacks/add-callback model-name :after-load (callb/transform-value attribute read-string)))
(defn expand-init-option
"init-model macro-expansion delegate that generates a call to add-validation."
@@ -6,19 +6,6 @@
clj-record.test-helper))
-(deftest serializes-simple-clojure-types
- (are [serialized-value value] (= serialized-value (serialization/serialize value))
- "\"123\"" "123"
- "123" 123))
-
-(deftest serializes-and-deserializes-clojure-types-symmetrically
- (are [value] (= value (serialization/deserialize (serialization/serialize value)))
- nil
- [1 2 3]
- {:a "Aee" :b "Bee" :c "See"}
- #{1 :b "See"}
- '(1 2 [hey now])))
-
(defdbtest serialized-attributes-support-common-clojure-types
(restoring-ref (manufacturer/model-metadata)
(serialization/serialize-attribute "manufacturer" :name)

0 comments on commit 885e737

Please sign in to comment.