Class: Datadog::Core::Configuration::OptionDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/configuration/option_definition.rb,
sig/datadog/core/configuration/option_definition.rbs

Overview

Represents a definition for an integration configuration option

Defined Under Namespace

Classes: Builder

Constant Summary collapse

IDENTITY =

Returns:

  • (setter_proc)
->(new_value, _old_value) { new_value }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attributes, &block) ⇒ OptionDefinition

Returns a new instance of OptionDefinition.

Parameters:

  • name (String, Symbol)
  • attributes (attributes_with_required_options)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/datadog/core/configuration/option_definition.rb', line 26

def initialize(name, attributes, &block)
  # When a settings is defined using the config DSL, an option is also created.
  # See Datadog::Core::Configuration::Base::ClassMethods#settings for more details.
  # This flag is used to indicate that the option is a settings option.
  @is_settings = attributes[:is_settings]

  @default = attributes[:default]
  @default_proc = attributes[:default_proc]
  @env = attributes[:env]
  @env_parser = attributes[:env_parser]
  @name = name.to_sym
  @after_set = attributes[:after_set]
  @skip_telemetry = attributes[:skip_telemetry]
  @resetter = attributes[:resetter]
  @setter = attributes[:setter] || block || IDENTITY
  @type = attributes[:type]
  @type_options = attributes[:type_options]
end

Instance Attribute Details

#after_setObject (readonly)

Returns the value of attribute after_set.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def after_set
  @after_set
end

#defaultObject (readonly)

Returns the value of attribute default.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def default
  @default
end

#default_procObject (readonly)

Returns the value of attribute default_proc.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def default_proc
  @default_proc
end

#envObject (readonly)

Returns the value of attribute env.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def env
  @env
end

#env_parserObject (readonly)

Returns the value of attribute env_parser.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def env_parser
  @env_parser
end

#is_settingsObject (readonly)

Returns the value of attribute is_settings.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def is_settings
  @is_settings
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def name
  @name
end

#resetterObject (readonly)

Returns the value of attribute resetter.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def resetter
  @resetter
end

#setterObject (readonly)

Returns the value of attribute setter.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def setter
  @setter
end

#skip_telemetryObject (readonly)

Returns the value of attribute skip_telemetry.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def skip_telemetry
  @skip_telemetry
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def type
  @type
end

#type_optionsObject (readonly)

Returns the value of attribute type_options.



12
13
14
# File 'lib/datadog/core/configuration/option_definition.rb', line 12

def type_options
  @type_options
end

Instance Method Details

#build(context) ⇒ Object

Creates a new Option, bound to the context provided.



46
47
48
# File 'lib/datadog/core/configuration/option_definition.rb', line 46

def build(context)
  Option.new(self, context)
end