Module: Datadog::Environment::Helpers

Defined in:
lib/ddtrace/environment.rb

Overview

Defines helper methods for environment

Instance Method Summary collapse

Instance Method Details

#env_to_bool(var, default = nil) ⇒ Object



6
7
8
# File 'lib/ddtrace/environment.rb', line 6

def env_to_bool(var, default = nil)
  ENV.key?(var) ? ENV[var].to_s.downcase == 'true' : default
end

#env_to_float(var, default = nil) ⇒ Object



10
11
12
# File 'lib/ddtrace/environment.rb', line 10

def env_to_float(var, default = nil)
  ENV.key?(var) ? ENV[var].to_f : default
end

#env_to_list(var, default = []) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ddtrace/environment.rb', line 14

def env_to_list(var, default = [])
  if ENV.key?(var)
    ENV[var].split(',').map(&:strip)
  else
    default
  end
end