def hash_dig(hash, *keys)
      keys.inject(hash) { |res, key| res[key] or return nil }
    end
def hash_dig(hash, *keys)
      keys.inject(hash) { |res, key| res[key] or return nil }
    end
TODO: replace with Hash#dig when minimal Ruby version would be 2.3