Sha256: 0295100e7519a1fa60a7bfc86996fac811fc178d1324bbd6920c761a8fa4da10

Contents?: true

Size: 618 Bytes

Versions: 15

Compression:

Stored size: 618 Bytes

Contents

module Datadog
  module Configuration
    # Represents a definition for an integration configuration option
    class OptionDefinition
      IDENTITY = ->(x) { x }

      attr_reader \
        :default,
        :depends_on,
        :lazy,
        :name,
        :setter

      def initialize(name, meta = {}, &block)
        @default = meta[:default]
        @depends_on = meta[:depends_on] || []
        @lazy = meta[:lazy] || false
        @name = name.to_sym
        @setter = meta[:setter] || block || IDENTITY
      end

      def default_value
        lazy ? @default.call : @default
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ddtrace-0.26.1 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.28.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.27.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.26.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.25.1 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.25.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.24.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.23.3 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.23.2 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.23.1 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.23.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.22.0 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.21.2 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.21.1 lib/ddtrace/configuration/option_definition.rb
ddtrace-0.21.0 lib/ddtrace/configuration/option_definition.rb