Sha256: 64575cecf79f5ab6f9e45cd339804395d32af6a234a22f0a7fecaac7ce03b98c
Contents?: true
Size: 322 Bytes
Versions: 10
Compression:
Stored size: 322 Bytes
Contents
class Hash # Iterate over hash updating just the values. # # h = {:a=>1, :b=>2} # h.update_values{ |v| v+1 } # h #=> { a:=>2, :b=>3 } # # CREDIT: Trans def update_values #:yield: if block_given? each{ |k,v| store(k, yield(v)) } else to_enum(:update_values) end end end
Version data entries
10 entries across 10 versions & 1 rubygems