(extend-string-like cls {:keys [read write meta] :as opts})creates an entry for string-like classes
(extend-string-like java.io.File {:tag "path" :read (fn [f] (.getPath f)) :write (fn [^String path] (java.io.File. path))})
(object/from-data "/home" java.io.File)
(with-out-str (prn (java.io.File. "/home"))) => "#path "/home"\n"
creates an entry for string-like classes
(extend-string-like
java.io.File
{:tag "path"
:read (fn [f] (.getPath f))
:write (fn [^String path] (java.io.File. path))})
(object/from-data "/home" java.io.File)
(with-out-str
(prn (java.io.File. "/home")))
=> "#path \"/home\"\n"cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |