= private = protected
uniq()
Returns a new array by removing duplicate values in self.
a = [ "a", "a", "b", "b", "c" ] a.uniq #=> ["a", "b", "c"]
/* * call-seq: * array.uniq -> an_array * * Returns a new array by removing duplicate values in <i>self</i>. * * a = [ "a", "a", "b", "b", "c" ] * a.uniq #=> ["a", "b", "c"] */ static VALUE rb_ary_uniq(ary) VALUE ary; { ary = rb_ary_dup(ary); rb_ary_uniq_bang(ary); return ary; }
Build hash from elements of your Array using attribute as key and the element as value and return values of Hash:
Hash[*ary.map {|obj| [obj.name, obj]}.flatten].values