Sha256: 800fa1e22aa1f263a39431e3fbaea6c268419fee267f4c9af526623bf484c92b

Contents?: true

Size: 345 Bytes

Versions: 3

Compression:

Stored size: 345 Bytes

Contents

class Hash

  # Iterates through each pair and updates the hash
  # in place. This is formally equivalent to #mash!
  # But does not use #mash to accomplish the task.
  # Hence #update_each is probably a touch faster.
  #
  # CREDIT: Trans

  def update_each  # :yield:
    dup.each do |k,v|
     update(yield(k,v))
    end
    self
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/hash/update_each.rb
facets-3.1.0 lib/core/facets/hash/update_each.rb
facets-3.0.0 lib/core/facets/hash/update_each.rb