Class: ScoutApm::Config::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/config.rb

Overview

Attempts to load a configuration file, and parse it as YAML. If the file is not found, inaccessbile, or unparsable, log a message to that effect, and move on.

Instance Method Summary collapse

Constructor Details

#initialize(file_path = nil, config = {}) ⇒ ConfigFile

Returns a new instance of ConfigFile.



207
208
209
210
211
# File 'lib/scout_apm/config.rb', line 207

def initialize(file_path=nil, config={})
  @config = config || {}
  @resolved_file_path = file_path || determine_file_path
  load_file(@resolved_file_path)
end

Instance Method Details

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


222
223
224
# File 'lib/scout_apm/config.rb', line 222

def has_key?(key)
  @settings.has_key?(key)
end

#value(key) ⇒ Object



213
214
215
216
217
218
219
220
# File 'lib/scout_apm/config.rb', line 213

def value(key)
  if @file_loaded
    val = @settings[key]
    val.to_s.strip.length.zero? ? nil : val
  else
    nil
  end
end