Class: ScoutApm::Config::ConfigFile
- Inherits:
-
Object
- Object
- ScoutApm::Config::ConfigFile
- 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
- #any_keys_found? ⇒ Boolean
- #has_key?(key) ⇒ Boolean
-
#initialize(context, file_path = nil, config = {}) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
- #name ⇒ Object
- #value(key) ⇒ Object
Constructor Details
#initialize(context, file_path = nil, config = {}) ⇒ ConfigFile
Returns a new instance of ConfigFile.
399 400 401 402 403 404 |
# File 'lib/scout_apm/config.rb', line 399 def initialize(context, file_path=nil, config={}) @context = context @config = config || {} @resolved_file_path = file_path || determine_file_path load_file(@resolved_file_path) end |
Instance Method Details
#any_keys_found? ⇒ Boolean
419 420 421 422 423 |
# File 'lib/scout_apm/config.rb', line 419 def any_keys_found? KNOWN_CONFIG_OPTIONS.any? { |option| @settings.has_key?(option) } end |
#has_key?(key) ⇒ Boolean
415 416 417 |
# File 'lib/scout_apm/config.rb', line 415 def has_key?(key) @settings.has_key?(key) end |
#name ⇒ Object
425 426 427 |
# File 'lib/scout_apm/config.rb', line 425 def name "config-file" end |
#value(key) ⇒ Object
406 407 408 409 410 411 412 413 |
# File 'lib/scout_apm/config.rb', line 406 def value(key) if @file_loaded val = @settings[key] val.to_s.strip.length.zero? ? nil : val else nil end end |