ary.uniq! â ary or nilary.uniq! { |item| ... } â ary or nil
Instance Public methods
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","