lib/contrast/config/base_configuration.rb in contrast-agent-6.4.0 vs lib/contrast/config/base_configuration.rb in contrast-agent-6.5.0
- old
+ new
@@ -8,15 +8,21 @@
module Config
# This is the base for our configuration classes. It is intended to facilitate the translation of the Common
# Configuration settings to usable Ruby classes.
module BaseConfiguration
extend Forwardable
+ AT_UNDERSCORE = '@_'
def to_hash
hsh = {}
instance_variables.each do |iv|
- # strip the '@' to get the key
- key = iv.to_s[1..]
+ # strip the '@' of '@_' to get the key
+ string_iv = iv.to_s
+ key = if string_iv.include?(AT_UNDERSCORE)
+ string_iv[2..]
+ else
+ string_iv[1..]
+ end
hsh[key] = send(key.to_sym)
end
hsh
end
end