lib/timber/current_context.rb in timber-2.6.0.pre.beta1 vs lib/timber/current_context.rb in timber-2.6.0.pre.beta2
- old
+ new
@@ -118,10 +118,16 @@
# Snapshots the current context so that you get a moment in time representation of the context,
# since the context can change as execution proceeds. Note that individual contexts
# should be immutable, and we implement snapshot caching as a result of this assumption.
def snapshot
- @snapshot ||= hash.clone
+ @snapshot ||= begin
+ snapshot = hash.clone
+ if snapshot.key?(:custom)
+ snapshot[:custom] = hash[:custom].clone
+ end
+ snapshot
+ end
end
private
# The internal hash that is maintained. Use {#with} and {#add} for hash maintenance.
def hash