Back

read-string (clj)

(source)

function

(read-string s) (read-string opts s)
Read a config from a string of edn. Refs may be denotied by tagging keywords with #ig/ref.

Examples

integrant
(ns integrant.core-test
  (:require #?(:clj  [clojure.test :refer [are deftest is testing]]
               :cljs [cljs.test :refer-macros [are deftest is testing]])
            [integrant.core :as ig]
            [weavejester.dependency :as dep]))

#?(:clj
   (deftest read-string-test
     (is (= (ig/read-string "{:foo/a #ig/ref :foo/b, :foo/b 1}")
            {:foo/a (ig/ref :foo/b), :foo/b 1}))
     (is (= (ig/read-string "{:foo/a #ig/refset :foo/b, :foo/b 1}")
            {:foo/a (ig/refset :foo/b), :foo/b 1}))
     (is (= (ig/read-string {:readers {'test/var find-var}}
                            "{:foo/a #test/var clojure.core/+}")
            {:foo/a #'+}))))
gizmo385/discord.clj
(ns user
  (:use
    [clojure.repl]
    [clojure.pprint])
  (:require
    [discord.bot :as bot]
    [integrant.core :as ig]
    [integrant.repl :refer [clear go halt prep init suspend resume reset reset-all]]
    [integrant.repl.state :as state]))

(let [config (ig/read-string (slurp "resources/integrant-config.edn"))]
  (integrant.repl/set-prep! (constantly config)))
jacekschae/learn-reitit-course-files
(ns user
  (:require [integrant.repl :as ig-repl]
            [integrant.core :as ig]
            [integrant.repl.state :as state]
            [cheffy.server]))

(ig-repl/set-prep!
  (fn [] (-> "resources/config.edn" slurp ig/read-string)))
jacekschae/learn-reitit-course-files
(ns user
  (:require [integrant.repl :as ig-repl]
            [integrant.core :as ig]
            [integrant.repl.state :as state]
            [cheffy.server]))

(ig-repl/set-prep!
  (fn [] (-> "resources/config.edn" slurp ig/read-string)))
jacekschae/learn-reitit-course-files
(ns user
  (:require [integrant.repl :as ig-repl]
            [integrant.core :as ig]
            [integrant.repl.state :as state]
            [cheffy.server]))

(ig-repl/set-prep!
  (fn [] (-> "resources/config.edn" slurp ig/read-string)))
jacekschae/learn-datomic-course-files
(ns user
  (:require [integrant.repl :as ig-repl]
            [integrant.core :as ig]
            [integrant.repl.state :as state]
            [cheffy.server]))

(ig-repl/set-prep!
  (fn [] (-> "src/dev/resources/config.edn" slurp ig/read-string)))