class Storexplore::HashUtils

Public Class Methods

contains?(hash,other) click to toggle source
# File lib/storexplore/hash_utils.rb, line 27
def self.contains?(hash,other)
  other.all? do |key, value|
    hash.include?(key) && hash[key] == value
  end
end
internalize_keys(hash) click to toggle source
# File lib/storexplore/hash_utils.rb, line 47
def self.internalize_keys(hash)
  result = {}
  hash.each do |key, value|
    result[key.intern] = value
  end
  result
end
stringify_keys(hash) click to toggle source
# File lib/storexplore/hash_utils.rb, line 39
def self.stringify_keys(hash)
  result = {}
  hash.each do |key, value|
    result[key.to_s] = value
  end
  result
end
without(hash,keys) click to toggle source
# File lib/storexplore/hash_utils.rb, line 33
def self.without(hash,keys)
  hash.reject do |key, value|
    keys.include?(key)
  end
end