Permalink
Browse files

delay converting to strings

  • Loading branch information...
1 parent 3885145 commit 9ad0722729dccd41ee909787fac17d4a769982e6 @joegallo committed Nov 12, 2011
Showing with 4 additions and 3 deletions.
  1. +2 −1 src/doric/core.clj
  2. +1 −1 src/doric/csv.clj
  3. +1 −1 test/doric/test/core.clj
View
@@ -39,10 +39,11 @@
(map str data))))))
(defn format-cell [col s]
- (str ((:format col) s)))
+ ((:format col) s))
(defn align-cell [col s align]
(let [width (:width col)
+ s (str s)
s (cond (<= (count s) width) s
(:ellipsis col) (str (subs s 0 (- width 3)) "...")
:else (subs s 0 width))
View
@@ -8,7 +8,7 @@
(def td unaligned-td)
(defn escape [s]
- (let [s (.replaceAll s "\"" "\"\"")]
+ (let [s (.replaceAll (str s) "\"" "\"\"")]
(if (re-find #"[,\n\"]" s)
(str "\"" s "\"")
s)))
@@ -44,7 +44,7 @@
(is (= 7 (width {:name :foobar} ["foobar2"]))))
(deftest test-format-cell
- (is (= "2" (format-cell {:format inc} 1))))
+ (is (= 2 (format-cell {:format inc} 1))))
(deftest test-align-cell
(is (= "." (align-cell {:width 1} "." :left)))

0 comments on commit 9ad0722

Please sign in to comment.