class FlexibleConfig::NotFound

Public Class Methods

new(key = 'unknown.key') click to toggle source
Calls superclass method
# File lib/flexible_config/not_found.rb, line 3
def initialize(key = 'unknown.key')
  super error_message_from key
end

Private Instance Methods

error_message_from(key) click to toggle source
# File lib/flexible_config/not_found.rb, line 9
def error_message_from(key)
  file_base_name, *yml_keys = key.split '.'

  env_var     = key.upcase.gsub '.', '_'
  environment = WrappedEnv.fetch('RAILS_ENV') { 'default' }
  yml_key     = "#{environment}.#{yml_keys.join '.'}"
  file_name   = "./config/settings/#{file_base_name}.yml"

  "#{self.class} Exception. Configuration value not found. Consider " \
    "setting the #{env_var} environment variable, or setting the " \
    "#{yml_key} property in the following file: #{file_name}"
end