Liking cljdoc? Tell your friends :D

hara.object.access


getclj

(get obj k)

accessor with either keyword or array lookup

(access/get (test.Cat. "spike") :name) => "spike"

accessor with either keyword or array lookup

(access/get (test.Cat. "spike") :name)
=> "spike"
raw docstring

get-with-arrayclj

(get-with-array obj arr)

access the fields of an object with an array of keywords

(get-with-array {:a 1} [:a]) => {:a 1}

(get-with-array (test.Cat. "spike") [:name :species]) => {:name "spike", :species "cat"}

access the fields of an object with an array of keywords

(get-with-array {:a 1} [:a])
=> {:a 1}

(get-with-array (test.Cat. "spike")
                  [:name :species])
=> {:name "spike", :species "cat"}
raw docstring

get-with-keywordclj

(get-with-keyword obj k)

access the fields of an object with keyword

(get-with-keyword {:a 1} :a) => 1

(get-with-keyword (test.Cat. "spike") :species) => "cat"

access the fields of an object with keyword

(get-with-keyword {:a 1} :a)
=> 1

(get-with-keyword (test.Cat. "spike")
                  :species)
=> "cat"
raw docstring

setclj

(set obj m)
(set obj k v)

sets the fields of an object with a map

(-> (doto (test.Cat. "spike") (access/set {:name "fluffy"})) (access/get :name)) => "fluffy"

sets the fields of an object with a map

(-> (doto (test.Cat. "spike")
      (access/set {:name "fluffy"}))
    (access/get :name))
=> "fluffy"
raw docstring

set-with-keywordclj

(set-with-keyword obj k v)

sets the fields of an object with keyword

(-> (doto (test.Cat. "spike") (set-with-keyword :name "fluffy")) (access/get :name)) => "fluffy"

sets the fields of an object with keyword

(-> (doto (test.Cat. "spike")
      (set-with-keyword :name "fluffy"))
    (access/get :name))
=> "fluffy"
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close