Class: DatadogExporter::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_exporter/configuration.rb

Overview

The global configuration of the DatadogExporter client.

See Also:

Constant Summary collapse

DEFAULT_ORG_CONFIG_FILENAME =
"organizations_config.yml".freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
# File 'lib/datadog_exporter/configuration.rb', line 9

def initialize
  @config = {}
end

Class Method Details

.add_setting(name, default) ⇒ Object

Create a getter and a setter for a setting.

If the default value is a Proc, it will be called on initialize.

Parameters:

  • name:

    Symbol

  • default:

    Proc | Object



20
21
22
23
24
25
26
27
28
# File 'lib/datadog_exporter/configuration.rb', line 20

def self.add_setting(name, default)
  define_method name do
    @config[name] ||= default.is_a?(Proc) ? default.call : default
  end

  define_method :"#{name}=" do |value|
    @config[name] = value
  end
end