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

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

Overview

Represents a definition for an integration configuration option

Defined Under Namespace

Classes: Builder

Constant Summary collapse

IDENTITY =
->(new_value, _old_value) { new_value }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, meta = {}, &block) ⇒ OptionDefinition

Returns a new instance of OptionDefinition.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/datadog/core/configuration/option_definition.rb', line 25

def initialize(name, meta = {}, &block)
  @default = meta[:default]
  @default_proc = meta[:default_proc]
  @env = meta[:env]
  @deprecated_env = meta[:deprecated_env]
  @env_parser = meta[:env_parser]
  @name = name.to_sym
  @after_set = meta[:after_set]
  @resetter = meta[:resetter]
  @setter = meta[:setter] || block || IDENTITY
  @type = meta[:type]
  @type_options = meta[: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

#deprecated_envObject (readonly)

Returns the value of attribute deprecated_env.



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

def deprecated_env
  @deprecated_env
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

#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

#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.



40
41
42
# File 'lib/datadog/core/configuration/option_definition.rb', line 40

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