class Hash

Public Instance Methods

hmap(&block) click to toggle source
# File lib/kafkat/command/reassign.rb, line 12
def hmap(&block)
  h = Hash.new
  self.keys.each do |key|
    hash = block.call(key, self[key])

    h[hash.keys.first] = hash[hash.keys.first]
  end
  h
end
hmap!(&block) click to toggle source
# File lib/kafkat/command/reassign.rb, line 2
def hmap!(&block)
  self.keys.each do |key|
    hash = block.call(key, self[key])

    self[hash.keys.first] = hash[hash.keys.first]
    self.delete(key)
  end
  self
end