Super-quick, clean implementation to determine if a hash[:key1][“key2”][“key3”] exists for use in conditionals.
[:key1,:key2].inject(hash){|h,k| h && h[k]}
Cred goes to SO user taw. Thanks!
Super-quick, clean implementation to determine if a hash[:key1][“key2”][“key3”] exists for use in conditionals.
[:key1,:key2].inject(hash){|h,k| h && h[k]}
Cred goes to SO user taw. Thanks!