Module: NtqTools::Translations::HashUtils

Included in:
YamlTool
Defined in:
lib/ntq_tools/translations/hash_utils.rb

Instance Method Summary collapse

Instance Method Details

#dig_set(obj, keys, value) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/ntq_tools/translations/hash_utils.rb', line 4

def dig_set(obj, keys, value)
  key = keys.first
  if keys.length == 1
    obj[key] = value
  else
    obj[key] = {} unless obj[key]
    dig_set(obj[key], keys.slice(1..-1), value)
  end
end