require 'set' nodes = ['server1','server1','server2'] p nodes.to_set # #<Set: {"server1", "server2"}>