class Honeybadger::ContextManager

@api private

Attributes

custom[RW]
rack_env[RW]

Public Class Methods

current() click to toggle source
# File lib/honeybadger/context_manager.rb, line 8
def self.current
  Thread.current[:__hb_context_manager] ||= new
end
new() click to toggle source
# File lib/honeybadger/context_manager.rb, line 12
def initialize
  @mutex = Mutex.new
  _initialize
end

Public Instance Methods

clear!() click to toggle source
# File lib/honeybadger/context_manager.rb, line 17
def clear!
  _initialize
end
get_context() click to toggle source
# File lib/honeybadger/context_manager.rb, line 31
def get_context
  @mutex.synchronize { @context }
end
get_rack_env() click to toggle source
# File lib/honeybadger/context_manager.rb, line 39
def get_rack_env
  @mutex.synchronize { @rack_env }
end
set_context(hash) click to toggle source

Internal helpers

# File lib/honeybadger/context_manager.rb, line 24
def set_context(hash)
  @mutex.synchronize do
    @context ||= {}
    @context.update(Context(hash))
  end
end
set_rack_env(env) click to toggle source
# File lib/honeybadger/context_manager.rb, line 35
def set_rack_env(env)
  @mutex.synchronize { @rack_env = env }
end

Private Instance Methods

_initialize() click to toggle source
# File lib/honeybadger/context_manager.rb, line 47
def _initialize
  @mutex.synchronize do
    @context = nil
    @rack_env = nil
  end
end