Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 23adde539c
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (24 sloc) 0.694 kb
(ns ciste.views.default
(:use [ciste.views :only [apply-view-by-format]])
(:require [clojure.data.json :as json]
[clojure.pprint :as p]
[clojure.string :as string]))
(defmethod apply-view-by-format :json
[_ & args]
{:body (apply json/json-str args)})
;; TODO: Use something other than prxml
(defmethod apply-view-by-format :xml
;; {:doc "Attempts to render an unsupported type as xml"}
[{:keys [action]} & _]
{:body
{:tag
(keyword
(last
(string/split
(str (:ns (meta action)))
#"\.")))
:attrs nil
:content nil}})
(defmethod apply-view-by-format :clj
[_ & args]
{:body (with-out-str (p/pprint (first args)))})
Jump to Line
Something went wrong with that request. Please try again.