method
uniq!

uniq!()
public
Removes duplicate elements from self.
If a block is given, it will use the return value of the block for comparison.
It compares values using their #hash and #eql? methods for efficiency.
Returns nil if no changes are made (that is, no duplicates are found).
a = [ "a", "a", "b", "b", "c" ] a.uniq! # => ["a", "b", "c"] b = [ "a", "b", "c" ] b.uniq! # => nil c = [["student","sam"], ["student","george"], ["teacher","matz"]] c.uniq! { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]]