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

Version Path
katello-4.13.1 app/models/katello/hash_util.rb
katello-4.13.0 app/models/katello/hash_util.rb
katello-4.12.1 app/models/katello/hash_util.rb
katello-4.13.0.rc1 app/models/katello/hash_util.rb
katello-4.12.0 app/models/katello/hash_util.rb
katello-4.12.0.rc3 app/models/katello/hash_util.rb
katello-4.12.0.rc2 app/models/katello/hash_util.rb
katello-4.12.0.rc1 app/models/katello/hash_util.rb
katello-4.11.1 app/models/katello/hash_util.rb
katello-4.11.0 app/models/katello/hash_util.rb
katello-4.11.0.rc2 app/models/katello/hash_util.rb
katello-4.11.0.rc1 app/models/katello/hash_util.rb
katello-4.10.0 app/models/katello/hash_util.rb
katello-4.9.2 app/models/katello/hash_util.rb
katello-4.10.0.rc2 app/models/katello/hash_util.rb
katello-4.10.0.rc1 app/models/katello/hash_util.rb
katello-4.8.4 app/models/katello/hash_util.rb
katello-4.9.1 app/models/katello/hash_util.rb
katello-4.8.3 app/models/katello/hash_util.rb
katello-4.9.0 app/models/katello/hash_util.rb