Sha256: 2b7f94de76dde211bb3d9fe8b0d58cf0f09e900691e23e6e323a91b9804e62de

Contents?: true

Size: 782 Bytes

Versions: 4

Compression:

Stored size: 782 Bytes

Contents

require "datadog/core/configuration/base"

module Datadog
  module CI
    module Contrib
      # Common settings for all integrations
      # @public_api
      class Settings
        include Core::Configuration::Base

        option :enabled, default: true
        option :service_name
        option :operation_name

        def configure(options = {})
          self.class.options.each do |name, _value|
            self[name] = options[name] if options.key?(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

4 entries across 4 versions & 1 rubygems

Version Path
datadog-ci-0.4.1 lib/datadog/ci/contrib/settings.rb
datadog-ci-0.4.0 lib/datadog/ci/contrib/settings.rb
datadog-ci-0.3.0 lib/datadog/ci/contrib/settings.rb
datadog-ci-0.2.0 lib/datadog/ci/contrib/settings.rb