fetch
by default raises an error if the key is not found. You can supply a default value instead.
h = {}
h.fetch(:foo) # no default value, raises error
# => # ~> -:3:in `fetch': key not found: :foo (KeyError)
h.fetch(:bar, 10) # default value, returns default value
# => 10