Sha256: a40ce7f7131d0272955d4ae405a14eb8e6ce9ca2c3d17c613b8685b8e13585bd

Contents?: true

Size: 218 Bytes

Versions: 20

Compression:

Stored size: 218 Bytes

Contents

class Hash

  # Same as #update_each, but deletes the key element first.
  #
  # CREDIT: Trans

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

end

Version data entries

20 entries across 19 versions & 2 rubygems

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