Today I Learned

A Hashrocket project

ruby has get-in, but it's called dig!

Ever miss that sweet functional language feature when you’re in ruby?

(get-in {:a [{:b 2}]} [:a 0 :b])
=> 2

docs

Well, if you’re on ruby >= 2.3, you can!

{a: [b: 2]}.dig(:a, 0, :b)
=> 2

docs

Looking for help? Each developer at Hashrocket has years of experience working with Ruby applications of all types and sizes. Contact us and find out how we can help you.