From: "Stephan J. Schmidt" Date: 2002-05-31T23:25:32+09:00 Subject: Re: Array Uniq Thanks a lot, bye -stephan On Fri, 2002-05-31 at 16:19, ts wrote: > >>>>> "S" == Stephan J Schmidt writes: > > S> this didn't work, any idea what I do wrong ? > > Here an example > > pigeon% cat b.rb > #!/usr/bin/ruby > class A > attr_reader :iod > def initialize(oid) > @iod = oid > end > def hash > @iod.hash > end > def eql?(b) > if b.kind_of?(A) > @iod.eql?(b.iod) > else > false > end > end > end > > a = [] > a.push A.new(12), A.new(12), A.new(34), A.new(34) > p a > p a.uniq! > pigeon% > > pigeon% b.rb > [#, #, #, #] > [#, #] > pigeon% > > > Guy Decoux