Skip to content

Commit

Permalink
Merge pull request weavejester#43 from lynaghk/master
Browse files Browse the repository at this point in the history
Ratios should render as floating point numbers
  • Loading branch information
weavejester committed Apr 10, 2012
2 parents b592e8c + 06746b8 commit b86689d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hiccup/util.clj
Expand Up @@ -19,6 +19,8 @@
(extend-protocol ToString
clojure.lang.Keyword
(to-str [k] (name k))
clojure.lang.Ratio
(to-str [r] (str (float r)))
java.net.URI
(to-str [u]
(if (or (.isAbsolute u)
Expand Down
1 change: 1 addition & 0 deletions test/hiccup/test/util.clj
Expand Up @@ -14,6 +14,7 @@
(is (= (as-str "foo") "foo"))
(is (= (as-str :foo) "foo"))
(is (= (as-str 100) "100"))
(is (= (as-str 4/3) (str (float 4/3))))
(is (= (as-str "a" :b 3) "ab3"))
(is (= (as-str (URI. "/foo")) "/foo")))

Expand Down

0 comments on commit b86689d

Please sign in to comment.