Sha256: 84af34e7d884aaf582d08c1de8061995d22c4d7ac8e1b911969c3d57704e0002
Contents?: true
Size: 352 Bytes
Versions: 16
Compression:
Stored size: 352 Bytes
Contents
class Hash # Iterate over hash updating just the keys. # # h = {:a=>1, :b=>2} # h.update_keys{ |k| "#{k}!" } # h #=> { "a!"=>1, "b!"=>2 } # # CREDIT: Trans def update_keys #:yield: if block_given? keys.each { |old_key| store(yield(old_key), delete(old_key)) } else to_enum(:update_keys) end end end
Version data entries
16 entries across 15 versions & 1 rubygems