class Datadog::Configuration::PinSetup

PinSetup translates a flat hash into a Pin configuration This class should be removed if we ever remove/refactor the Pin class

Constants

ATTRS
DEPRECATED_ATTRS

Attributes

opts[R]
pin[R]

Public Class Methods

new(target, opts = {}) click to toggle source
# File lib/ddtrace/configuration/pin_setup.rb, line 7
def initialize(target, opts = {})
  @pin = Pin.get_from(target)
  @opts = opts
end

Public Instance Methods

call() click to toggle source
# File lib/ddtrace/configuration/pin_setup.rb, line 12
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) || DEPRECATED_ATTRS.include?(key) }

  true
end