Sha256: eb12519dc3d93915dad6d6eba64827cf7e0712672cede16333479119b144a715

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true
# typed: true

require_relative 'helpers'

module Datadog
  module Tracing
    module Distributed
      # Common fetcher that retrieves fields from a Hash data input
      class Fetcher
        # @param data [Hash]
        def initialize(data)
          @data = data
        end

        def [](key)
          @data[key]
        end

        def id(key, base: 10)
          Helpers.value_to_id(self[key], base)
        end

        def number(key, base: 10)
          Helpers.value_to_number(self[key], base)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-1.9.0 lib/datadog/tracing/distributed/fetcher.rb
ddtrace-1.8.0 lib/datadog/tracing/distributed/fetcher.rb
ddtrace-1.7.0 lib/datadog/tracing/distributed/fetcher.rb