Sha256: 43b34eaaf2a053823514ee83e406ca8deea998a32d3e7f40efe2fa7848a63b3d
Contents?: true
Size: 725 Bytes
Versions: 238
Compression:
Stored size: 725 Bytes
Contents
module Katello class HashUtil def null_safe_get(hash, default, params) # Base case .. if we are down to the last param # lets actually try and find the value if params.size == 1 begin # If we got back null lets assign the default return hash[params[0]] || default rescue # If we errored out trying to fetch the value we return # default value. return default end end subhash = hash[params.first] # If we don't have a subhash don't try and recurse down if !subhash.nil? && !subhash.empty? self.null_safe_get(subhash, default, params[1..-1]) else default end end end end
Version data entries
238 entries across 238 versions & 1 rubygems