Sha256: 83ea9a4608bdf265cba2a0e45f4bafda6d30e6758f00c6650ac53db254500fb2

Contents?: true

Size: 337 Bytes

Versions: 1

Compression:

Stored size: 337 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module UU
  module LogContext
    attr_writer :context

    def context
      @context ||= {}
    end

    def with(context_)
      original_context = context
      self.context = context.merge(context_)
      yield
    ensure
      self.context = original_context
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uu-0.2.0 lib/uu/log_context.rb