From d758e4f89c77882c83e3ad71857f3f464d7937dc Mon Sep 17 00:00:00 2001 From: oakes Date: Sun, 12 Jan 2014 02:57:03 -0500 Subject: [PATCH] Make calls! more reliable --- src/play_clj/utils.clj | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/play_clj/utils.clj b/src/play_clj/utils.clj index 2f4e222..2558457 100644 --- a/src/play_clj/utils.clj +++ b/src/play_clj/utils.clj @@ -56,17 +56,18 @@ [a] (Array. true (into-array a) 1 (count a))) +(defn create-method-call + [[k v]] + (flatten (list (key->method k) (try (eval v) + (catch Exception _ v))))) + (defmacro call! [obj k & args] `(~(key->method k) ~obj ~@args)) -(defn calls!* - [[k v]] - (flatten (list (key->method k) (eval v)))) - (defmacro calls! [obj & {:keys [] :as args}] - `(doto ~obj ~@(map calls!* args))) + `(doto ~obj ~@(map create-method-call args))) (defmulti create-entity class)