Module: Configurate::Provider
- Defined in:
- lib/configurate/provider.rb,
lib/configurate/provider/env.rb,
lib/configurate/provider/yaml.rb,
lib/configurate/provider/dynamic.rb
Defined Under Namespace
Classes: Base, Dynamic, Env, YAML
Class Method Summary collapse
-
.lookup_in_hash(setting_path, hash) { ... } ⇒ Object
Utility function to lookup a settings path in a hash.
Class Method Details
.lookup_in_hash(setting_path, hash) { ... } ⇒ Object
Utility function to lookup a settings path in a hash
20 21 22 23 24 25 26 27 |
# File 'lib/configurate/provider.rb', line 20 def self.lookup_in_hash setting_path, hash, &fallback fallback ||= proc { nil } while hash.is_a?(Hash) && hash.has_key?(setting_path.first) && !setting_path.empty? hash = hash[setting_path.shift] end return fallback.call unless setting_path.empty? hash end |