I have the following hash:
hash = {\'name\' => { \'Mike\' => { \'age\' => 10, \'gender\' => \'m\' } } }
I can access the age by:
From Ruby 2.3.0 onward, you can use Hash#dig:
hash.dig('name', 'Mike', 'age')
It also comes with the added bonus that if some of the values along the way turned up to be nil, you will get nil instead of exception.
nil
You can use the ruby_dig gem until you migrate.