Permalink
Browse files

Merge (rather than reset) dictionary when loading resource

  • Loading branch information...
ptaoussanis committed Jan 4, 2013
1 parent 6b14ad2 commit abb1c76debfab1cc41d0b4443c7d69d9d17a7c62
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/taoensso/tower.clj
View
@@ -296,18 +296,18 @@
(atom {}))
(defn load-dictionary-from-map-resource!
- "Sets dictionary by reading Clojure map from named resource. Without any
- arguments, searches for `tower-dictionary.clj` in classpath and Leiningen's
- resource paths."
+ "Sets dictionary by reading and merging Clojure map from named resource.
+ Without any arguments, searches for `tower-dictionary.clj` in classpath and
+ Leiningen's resource paths."
([] (load-dictionary-from-map-resource! "tower-dictionary.clj"))
([resource-name]
- (try (->> resource-name
- io/resource
- io/reader
- slurp
- read-string
- (set-config! [:dictionary]))
- ;; For automatic dictionary reloading:
+ (try (merge-config!
+ {:dict-res-name resource-name ; For automatic reloading
+ :dictionary (-> resource-name
+ io/resource
+ io/reader
+ slurp
+ read-string)})
(set-config! [:dict-res-name] resource-name)
(catch Exception _
(throw (Exception. (str "Failed to load dictionary from resource: "

0 comments on commit abb1c76

Please sign in to comment.