Class: Honeybadger::Config::Yaml
- Inherits:
-
Hash
- Object
- Hash
- Honeybadger::Config::Yaml
- Defined in:
- lib/honeybadger/config/yaml.rb
Constant Summary collapse
- DISALLOWED_KEYS =
[:'config.path'].freeze
Instance Method Summary collapse
-
#initialize(path, env = 'production') ⇒ Yaml
constructor
A new instance of Yaml.
Constructor Details
#initialize(path, env = 'production') ⇒ Yaml
Returns a new instance of Yaml.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/honeybadger/config/yaml.rb', line 10 def initialize(path, env = 'production') @path = path.kind_of?(Pathname) ? path : Pathname.new(path) if !@path.exist? raise ConfigError, "The configuration file #{@path} was not found." elsif !@path.file? raise ConfigError, "The configuration file #{@path} is not a file." elsif !@path.readable? raise ConfigError, "The configuration file #{@path} is not readable." else yaml = load_yaml yaml.merge!(yaml[env]) if yaml[env].kind_of?(Hash) update(dotify_keys(yaml)) end end |