class Airbrake::Context

@since v5.2.1
@api private
Airbrake::Context.current.merge!(foo: ‘bar’)
@example
information added via {Airbrake.merge_context} calls.
Represents a thread-safe Airbrake context object, which carries arbitrary

def self.current

Returns:
  • (self) -
def self.current
  Thread.current[:airbrake_context] ||= new
end

def clear

Returns:
  • (Hash) - clears (resets) the current context
def clear
  @mutex.synchronize do
    @context.clear
  end
end

def empty?

Returns:
  • (Boolean) - checks whether the context has any data
def empty?
  @context.empty?
end

def initialize

def initialize
  @mutex = Mutex.new
  @context = {}
end

def merge!(other)

Returns:
  • (void) -

Parameters:
  • other (Hash{Object=>Object}) --
def merge!(other)
  @mutex.synchronize do
    @context.merge!(other)
  end
end

def to_h

Returns:
  • (Hash) - duplicated Hash context
def to_h
  @mutex.synchronize do
    @context.dup
  end
end