class Hash
def transform_keys
hash.transform_keys{ |key| key.to_s.upcase }
hash = { name: 'Rob', age: '28' }
Return a new hash with all keys converted using the block operation.
def transform_keys result = {} each_key do |key| result[yield(key)] = self[key] end result end