From: sawadatsuyoshi@... Date: 2017-01-11T07:07:03+00:00 Subject: [ruby-core:79052] [Ruby trunk Feature#13123] NilClass#dig Issue #13123 has been reported by Tsuyoshi Sawada. ---------------------------------------- Feature #13123: NilClass#dig https://bugs.ruby-lang.org/issues/13123 * Author: 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: