Excited about #dig in MRI 2.3.0? Want to use it in your gem code, but don’t want your gem to require MRI 2.3.0 yet?
I got you covered:
https://github.com/jrochkind/dig_rb
It’ll add in a pure-ruby #dig implementation if Hash/Array/Struct don’t have #dig yet. If they already have #dig defined, it’ll do nothing to them, so you can use dig_rb on gem code meant to run on any ruby. When run on MRI 2.3.0, you’ll be using native implementation, on other rubies dig_rb’s pure ruby implementation.
Note: JRuby 9k doesn’t support #dig yet either, and dig_rb will work fine there too.