class Hash

Public Instance Methods

try_path(*args) click to toggle source

Try provided path on hash

Parameters:

args

Keys of hash you want to try

Returns:

Value or nil if key does not exist
# File lib/utils/hash.rb, line 11
def try_path(*args)
  value = self
  args.each { |arg_name| value = value.nil? ? nil : value[arg_name] }
  value
end