Method: Sentry::Scope#set_contexts

Defined in:
lib/sentry/scope.rb

#set_contexts(contexts_hash) ⇒ Hash

Updates the scope’s contexts attribute by merging with the old value.

Parameters:

  • contexts (Hash)

Returns:

  • (Hash)

213
214
215
216
217
218
219
220
221
222
# File 'lib/sentry/scope.rb', line 213

def set_contexts(contexts_hash)
  check_argument_type!(contexts_hash, Hash)
  contexts_hash.values.each do |val|
    check_argument_type!(val, Hash)
  end

  @contexts.merge!(contexts_hash) do |key, old, new|
    old.merge(new)
  end
end