Sha256: 661b51bf528574541969c794907d85f7662312c10e870a82fd606cb855ff2e58
Contents?: true
Size: 468 Bytes
Versions: 18
Compression:
Stored size: 468 Bytes
Contents
# -*- coding: utf-8 -*- class Hash # Maps a hash into a hash, whose keys have been replaced with names of the # key objects (which are assumed to respond to +#name+ method). # def keys_to_names with_keys do |key| key.name || key end end # Modifies a hash in place so that the keys are replaced with key names (key # objects are assumed to respond to +#name+ method). # def keys_to_names! with_keys! do |key| key.name || key end end end
Version data entries
18 entries across 18 versions & 1 rubygems