Hash_dig

Given hash = { a: { b: { c: 'hi' } } }

You can safely “dig” for :c with hash.dig(:a, :b, :c) => 'hi'

Digging for a value that doesn’t exists results in nil: hash.dig(:a, :d) => nil