Skip to content

Commit

Permalink
📝 Introduce Hash#dig and link to more info
Browse files Browse the repository at this point in the history
  • Loading branch information
dideler committed Mar 20, 2016
1 parent 95b8ea4 commit 73b2c8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ Comparison:

##### `Hash#dig` vs `Hash#[]` vs `Hash#fetch` [code](code/hash/dig-vs-[]-fetch.rb)

[Ruby 2.3 introduced `Hash#dig`](http://ruby-doc.org/core-2.3.0/Hash.html#method-i-dig) which is a readable
and performant option for retrieval from a nested hash, returning `nil` if an extraction step fails.
See https://github.com/JuanitoFatas/fast-ruby/pull/102#issuecomment-198827506 for more info.

```
$ ruby -v code/hash/dig-vs-\[\]-vs-fetch.rb
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
Expand Down

0 comments on commit 73b2c8d

Please sign in to comment.