Issue #13123 has been updated by sawa (Tsuyoshi Sawada).


I am convinced by shyouhei's comment. Please close this feature request.

----------------------------------------
Feature #13123: NilClass#dig
https://bugs.ruby-lang.org/issues/13123#change-77966

* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
We now have `Hash#dig`. We often have a variable that is either a hash or nil but we are not sure which. In such cases, it would be convenient if we can apply `dig` without conditioning on whether it is a hash or nil.

```ruby
h = {a: 1}
h.dig(:a) # => 1

h = nil
h.dig(:a) # => nil
```



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>