Issue #8246 has been updated by marcandre (Marc-Andre Lafortune).

Assignee set to matz (Yukihiro Matsumoto)
Priority changed from Normal to Low

Marking as duplicate of #5531.
It's also related to #8237 because one could envision something like:

    hash[:level1]??.[:level2]??.[:non_existent_key] || 5


----------------------------------------
Feature #8246: Hash#traverse
https://bugs.ruby-lang.org/issues/8246#change-38419

Author: zzak (Zachary Scott)
Status: Open
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 


=begin
From ((<GH-275|URL:https://github.com/ruby/ruby/pull/275>))

Traverses the given levels of a hash and returns the value associated with the
last key provided. Allows for concise access for deeply nested hashes - often encountered with dealing with external restful apis.

(({hash = { level1: { level2: { level3: 3 } } }}))
(({hash.traverse :level1, :level2, :level3 #=> 3}))
Also supports a default value block if the value is nil or the key is
not found.

(({hash.traverse(:level1, :level2, :non_existent_key) { 5 } #=> 5})) 
=end


-- 
http://bugs.ruby-lang.org/