Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/noms/httpclient.rb

Direct Known Subclasses

NOMS::XmlHash

Instance Method Summary collapse

Instance Method Details

#set_deep(keypath, value) ⇒ Object

The mkdir -p of []=



29
30
31
32
33
34
35
36
# File 'lib/noms/httpclient.rb', line 29

def set_deep(keypath, value)
    if keypath.length == 1
        self[keypath[0]] = value
    else
        self[keypath[0]] ||= Hash.new
        self[keypath[0]].set_deep(keypath[1 .. -1], value)
    end
end