diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2010-05-26 12:32:41 -0400 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2010-05-28 07:52:54 -0400 |
commit | 4bea7a529bb14b99d48758cfaf0d71af0997f0ff (patch) | |
tree | b0ccf0d70d95c99fec5818f597b23a1909f87995 /src | |
parent | 89ed54ec8850bb3012c89c91d076a34837ca737e (diff) |
name handles strings
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/clj/clojure/core.clj | 4 | ||||
-rw-r--r-- | src/clj/clojure/java/shell.clj | 11 |
2 files changed, 3 insertions, 12 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index d1b4b8e4..65b3bc2d 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -1222,11 +1222,11 @@ (. rev (rseq))) (defn name - "Returns the name String of a symbol or keyword." + "Returns the name String of a string, symbol or keyword." {:tag String :added "1.0"} [^clojure.lang.Named x] - (. x (getName))) + (if (string? x) x (. x (getName)))) (defn namespace "Returns the namespace String of a symbol or keyword, or nil if not present." diff --git a/src/clj/clojure/java/shell.clj b/src/clj/clojure/java/shell.clj index e8a8427b..11d908a5 100644 --- a/src/clj/clojure/java/shell.clj +++ b/src/clj/clojure/java/shell.clj @@ -52,21 +52,12 @@ collecting its stdout"} [cmd opts] (split-with string? args)] [cmd (merge default-opts (apply hash-map opts))])) -(defn- as-env-key - "Helper so that callers can use symbols, keywords, or strings - when building an environment map." - [arg] - (cond - (symbol? arg) (name arg) - (keyword? arg) (name arg) - (string? arg) arg)) - (defn- as-env-string "Helper so that callers can pass a Clojure map for the :env to sh." [arg] (cond (nil? arg) nil - (map? arg) (into-array String (map (fn [[k v]] (str (as-env-key k) "=" v)) arg)) + (map? arg) (into-array String (map (fn [[k v]] (str (name k) "=" v)) arg)) true arg)) (defn sh |