The method you're looking for is merge
:
all_settings = defaults.merge(settings)
... will return a new hash containing all of the key-value pairs from defaults
, and all of the key-value pairs from settings
. If any key is duplicated, it will use the value from settings
.