Sha256: 5238da501b974d23c2cb7c781243a6519e44cc33c7537899e6cf3f543798af41

Contents?: true

Size: 689 Bytes

Versions: 38

Compression:

Stored size: 689 Bytes

Contents

module Datadog
  class Configuration
    # PinSetup translates a flat hash into a Pin configuration
    # This class should be removed if we ever remove/refactor the Pin class
    class PinSetup
      def initialize(target, opts = {})
        @pin = Pin.get_from(target)
        @opts = opts
      end

      def call
        return unless pin

        ATTRS.each { |key| pin.public_send("#{key}=", opts[key]) if opts[key] }

        pin.config = opts.reject { |key, _| ATTRS.include?(key) }

        true
      end

      private

      attr_reader :pin, :opts

      ATTRS = [:app, :tags, :app_type, :name, :tracer, :service_name].freeze

      private_constant :ATTRS
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
ddtrace-0.20.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.19.1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.19.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.18.3 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.18.2 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.18.1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.18.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.17.3 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.17.2 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.17.1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.17.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.16.1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.15.0.internaltracinfeature1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.16.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.14.2.disableprotocolversion4 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.15.0 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.14.2.withoutpriorityparsing1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.14.2 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.14.1 lib/ddtrace/configuration/pin_setup.rb
ddtrace-0.15.0.beta1 lib/ddtrace/configuration/pin_setup.rb