Sha256: 18425d2e951c19f34f1ab8c914cdf0bdb5d56487ca64fefd0b570635ef2b8fdf
Contents?: true
Size: 263 Bytes
Versions: 27
Compression:
Stored size: 263 Bytes
Contents
class Hash # Swap the values of a pair of keys in place. # # {:a=>1,:b=>2}.swap!(:a,:b) #=> {:a=>2,:b=>1} # # CREDIT: Gavin Sinclair def swap!(key1, key2) tmp = self[key1] self[key1] = self[key2] self[key2] = tmp self end end
Version data entries
27 entries across 26 versions & 3 rubygems