Sha256: 6c7cb859563ceba003f53526a466b528fd031ab506f6e5fb6413336b33fd68ca
Contents?: true
Size: 839 Bytes
Versions: 9
Compression:
Stored size: 839 Bytes
Contents
require_relative '../helpers' module Datadog module Tracing module Distributed module Metadata # Parser provides easy access and validation methods for metadata headers class Parser def initialize(metadata) @metadata = metadata end def id(key, base = 10) Helpers.value_to_id(metadata_for_key(key), base) end def number(key, base = 10) Helpers.value_to_number(metadata_for_key(key), base) end def metadata_for_key(key) # metadata values can be arrays (multiple headers with the same key) value = @metadata[key] if value.is_a?(Array) value.first else value end end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems