Sha256: fabf74c16cb3674c1a12b7809d5395949fd3b0385459d0791e978a8cb68e7ba7

Contents?: true

Size: 823 Bytes

Versions: 21

Compression:

Stored size: 823 Bytes

Contents

require 'ddtrace/contrib/configuration/options'

module Datadog
  module Contrib
    module Configuration
      # Common settings for all integrations
      class Settings
        include Options

        option :service_name
        option :tracer, default: Datadog.tracer

        def initialize(options = {})
          configure(options)
        end

        def configure(options = {})
          self.class.options.dependency_order.each do |name|
            self[name] = options.fetch(name, self[name])
          end

          yield(self) if block_given?
        end

        def [](name)
          respond_to?(name) ? send(name) : get_option(name)
        end

        def []=(name, value)
          respond_to?("#{name}=") ? send("#{name}=", value) : set_option(name, value)
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ddtrace-0.18.3 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.18.2 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.18.1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.18.0 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.17.3 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.17.2 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.17.1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.17.0 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.16.1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.15.0.internaltracinfeature1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.16.0 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.2.disableprotocolversion4 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.15.0 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.2.withoutpriorityparsing1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.2 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.15.0.beta1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.0 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.0.rc1 lib/ddtrace/contrib/configuration/settings.rb
ddtrace-0.14.0.beta2 lib/ddtrace/contrib/configuration/settings.rb