Method: Doing::Configuration#value_for_key
- Defined in:
- lib/doing/configuration.rb
#value_for_key(keypath = '') ⇒ Hash
Get the value for a fuzzy-matched key path
238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/doing/configuration.rb', line 238 def value_for_key(keypath = '') cfg = @settings real_path = ['config'] unless keypath =~ /^[.*]?$/ real_path = resolve_key_path(keypath, create: false) return nil unless real_path&.count&.positive? cfg = cfg.dig(*real_path) end cfg.nil? ? nil : { real_path[-1] => cfg } end |