dig
and fetch
are two powerful methods for manipulating a Hash object in Ruby.
dig
Pass the comma separated keys in the order of the nesting to dig the hash and obtain the value.
fetch
This method fetches value for key from the hash provided.
fetch
might raise KeyError
if the key doesn't exist and you don't pass a default value.