Rupert Voelcker
12/16/2008 9:13:00 AM
> I have a hash that contains duplicate data, for example, :username =>
> "alex" comes many times.
> I want to loop around and print their names just once (only unique). In
> simple loop it would print "alex" repeatedly.
hash.map { |k,v| v }.uniq.each { |name| puts name }
should do it
Rupert