Skip to content

Commit 8f77af0

Browse files
committed
Fixed inline-resource* which should be wrapped in #?(:clj ...)
1 parent e40f649 commit 8f77af0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/mate/io.cljc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@
2222
#_(resource-path *ns* "foo")
2323
#_(resource-path *ns* "./foo")
2424

25-
(defn inline-resource*
26-
([namespace-obj resource-name]
27-
(inline-resource* namespace-obj resource-name identity))
28-
([namespace-obj resource-name f & args]
29-
(let [resource-name (eval resource-name)
30-
path (resource-path namespace-obj resource-name)
31-
resource (io/resource path)
32-
_ (assert (some? resource)
33-
(str "Resource at path \"" path "\" not found."))
34-
resource-content (slurp resource)]
35-
(apply f resource-content args))))
25+
#?(:clj
26+
(defn inline-resource*
27+
([namespace-obj resource-name]
28+
(inline-resource* namespace-obj resource-name identity))
29+
([namespace-obj resource-name f & args]
30+
(let [resource-name (eval resource-name)
31+
path (resource-path namespace-obj resource-name)
32+
resource (io/resource path)
33+
_ (assert (some? resource)
34+
(str "Resource at path \"" path "\" not found."))
35+
resource-content (slurp resource)]
36+
(apply f resource-content args)))))
3637

3738
#_(inline-resource* *ns* "./test-resource.txt")
3839
#_(inline-resource* *ns* "./test-resource.txt" str/upper-case)

0 commit comments

Comments
 (0)