I have a big hash and I know that I almost always can get the data I need from hash['info'][1]['summary_result']['gsb']
. But from time to time these keys may not exist. To avoid an error I use rescue
like this:
begin
return hash['info'][1]['summary_result']['gsb']
rescue Exception
return nil
end
Are there any shorter methods to do it?