lib/betterlog/global_metadata.rb in betterlog-2.0.0 vs lib/betterlog/global_metadata.rb in betterlog-2.0.1
- old
+ new
@@ -18,13 +18,17 @@
def remove(data)
keys = data.ask_and_send_or_self(:keys).map(&:to_sym)
keys.each { current.delete(_1) }
end
- def with_context(data = {})
+ def with_meta(data = {}, &block)
add data
- yield current.dup.freeze
+ block.call(current.dup.freeze)
ensure
remove data
end
+ end
+
+ def self.with_meta(data = {}, &block)
+ Betterlog::GlobalMetadata.with_meta(data, &block)
end
end