Permalink
Browse files

Make pipe step checker more flexible

  • Loading branch information...
Darrick Wiebe
Darrick Wiebe committed Aug 26, 2012
1 parent 4c0f309 commit b2eaedb2436a238e837073f1abfef1778f8d9de5
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/pacer/step.clj
View
@@ -7,7 +7,13 @@
name)))
(defn check-step [in step]
- (when (not= (:source-type step) (:type in))
- (throw (Exception. (str (describe-step step) " expects type "
- (:source-type step) " but got " (:type in))))))
+ (println "check-step")
+ (when-let [rule (:source-type step)]
+ (let [type (:type in :unspecified)
+ check-fn (if (fn? rule)
+ rule
+ (fn [in] ((if (set? rule) rule (set [rule])) type)))]
+ (prn type rule check-fn)
+ (when-not (check-fn in)
+ (throw (Exception. (str "Step \""(describe-step step) "\" expects type " rule " but got " type)))))))

0 comments on commit b2eaedb

Please sign in to comment.