Skip to content

Commit

Permalink
Merge branch 'release-0.5.1'
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
	project.clj
  • Loading branch information
greglook committed May 14, 2014
2 parents f63b6bc + 9c96ab3 commit 4afc43b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -3,7 +3,7 @@ Puget

[![Build Status](https://travis-ci.org/greglook/puget.svg?branch=master)](https://travis-ci.org/greglook/puget)
[![Coverage Status](https://coveralls.io/repos/greglook/puget/badge.png?branch=master)](https://coveralls.io/r/greglook/puget?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/53718bfb14c1589a89000144/badge.png)](https://www.versioneye.com/user/projects/53718bfb14c1589a89000144)
[![Dependency Status](https://www.versioneye.com/user/projects/53718bfb14c1589a89000144/badge.png)](https://www.versioneye.com/clojure/mvxcvi:puget/0.5.1)

Puget is a Clojure library for printing [EDN](https://github.com/edn-format/edn)
values. Under the hood, Puget uses the
Expand Down Expand Up @@ -74,7 +74,7 @@ To use this version with Leiningen, add the following dependency to your project
definition:

```clojure
[mvxcvi/puget "0.5.0"]
[mvxcvi/puget "0.5.1"]
```

From the REPL, you can use the following helper functions for some control of
Expand Down
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject mvxcvi/puget "0.5.0"
(defproject mvxcvi/puget "0.5.1"
:description "Colorizing canonical Clojure printer for EDN values."
:url "https://github.com/greglook/puget"
:license {:name "Public Domain"
Expand Down
20 changes: 10 additions & 10 deletions src/puget/data.clj
Expand Up @@ -121,18 +121,17 @@

(defmacro extend-tagged-value
"Extends the TaggedValue protocol with implementations which return the
given symbol as the tag and use the body to calculate the value. The symbol
'this' is bound to the data. This macro also defines a print-method which
given symbol as the tag and use the given expression to calculate the value.
The expression should resolve to a function which accepts one argument and
returns the serialized value. This macro also defines a print-method which
delegates to edn-str."
[t tag expr]
`(do
`(let [value-fn# ~expr]
(extend-type ~t
TaggedValue
(edn-tag [~'this] ~tag)
(edn-value [~'this]
~(if (or (symbol? expr) (keyword? expr))
(list expr 'this)
expr)))
(edn-tag [this#] ~tag)
(edn-value [this#]
(value-fn# this#)))
(defprint-method ~t)))


Expand All @@ -143,7 +142,8 @@

(defmacro extend-tagged-map
[c tag]
`(extend-tagged-value ~c ~tag (into {} (seq ~'this))))
`(extend-tagged-value ~c ~tag
(comp (partial into {}) seq)))



Expand All @@ -169,7 +169,7 @@
; #bin - Binary data in the form of byte arrays.
(extend-tagged-value
(class (byte-array 0)) 'bin
(->> this b64/encode (map char) (apply str)))
#(->> % b64/encode (map char) (apply str)))


(defn read-bin
Expand Down

0 comments on commit 4afc43b

Please sign in to comment.