Sha256: d65e045cc2cc01642603736826fd49ce6fd991879ff4520e6d953dd013b15ab9

Contents?: true

Size: 347 Bytes

Versions: 17

Compression:

Stored size: 347 Bytes

Contents

class Hash

  # Iterates through each pair and updates a 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

17 entries across 16 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/hash/update_each.rb
facets-2.9.2 src/core/facets/hash/update_each.rb
facets-2.9.2 lib/core/facets/hash/update_each.rb
facets-2.9.1 lib/core/facets/hash/update_each.rb
facets-2.9.0 lib/core/facets/hash/update_each.rb
facets-2.9.0.pre.2 lib/core/facets/hash/update_each.rb
facets-2.9.0.pre.1 lib/core/facets/hash/update_each.rb
facets-2.8.4 lib/core/facets/hash/update_each.rb
facets-2.8.3 lib/core/facets/hash/update_each.rb
facets-2.8.2 lib/core/facets/hash/update_each.rb
facets-2.8.1 lib/core/facets/hash/update_each.rb
facets-2.8.0 lib/core/facets/hash/update_each.rb
facets-2.7.0 lib/core/facets/hash/update_each.rb
facets-2.6.0 lib/core/facets/hash/update_each.rb
facets-2.5.1 lib/core/facets/hash/update_each.rb
facets-2.5.0 lib/core/facets/hash/update_each.rb
facets-2.5.2 lib/core/facets/hash/update_each.rb