update
1.6
update(object) -> Hash
Updates hash with the key/value pairs of object
. The original hash will be modified.
Duplicate keys will cause an overwrite of hash’s keys. This is useful for selectively overwriting values on specific keys (e.g. exerting some level of control over a series of options).
The argument can be a Hash
or just a vanilla Object
.
Examples
var h = $H({ name: 'Prototype', version: 1.5 });
h.update({ version: 1.6, author: 'Sam' }).inspect();
// -> #<Hash:{'name': 'Prototype', 'version': 1.6, 'author': 'Sam'}>
h.inspect();
// -> #<Hash:{'name': 'Prototype', 'version': 1.6, 'author': 'Sam'}>
See also
If you need a non-destructive merge, try Hash#merge
.