Class: OpenTelemetry::Common::Propagation::SymbolKeyGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/common/propagation/symbol_key_getter.rb

Overview

The SymbolKeyGetter class provides a common method for reading symbol keys from a hash.

Instance Method Summary collapse

Instance Method Details

#get(carrier, key) ⇒ Object

Converts key into a symbol and reads it from the carrier. Useful for extract operations.



15
16
17
# File 'lib/opentelemetry/common/propagation/symbol_key_getter.rb', line 15

def get(carrier, key)
  carrier[key.to_sym]
end

#keys(carrier) ⇒ Object

Reads all keys from a carrier



20
21
22
# File 'lib/opentelemetry/common/propagation/symbol_key_getter.rb', line 20

def keys(carrier)
  carrier.keys.map(&:to_s)
end