Back

closeable-map (clj)

(source)

function

(closeable-map m)
Take any object that implements a map interface and return a new map that can later be closed. You may use this map like any other map for example with `update` or `assoc`. When you call `(.close m)`, inner closeable items will be closed. Map keys `::before-close` and `::after-close` will be evaluated before and after other keys of the map. Will ignore items marked with `^::ignore`, and exceptions thrown under `^::swallow` will be silently swallowed. Functions tagged with `^::fn` will be considered closeable. No checks on closing functions, the minimal requirement is they be invokable.

Examples