Logan Capaldo wrote: > On Dec 19, 2005, at 9:10 AM, Andrea wrote: > >> @descrizione = descrizione >> >> #<Termine:0x2ad5f20>:Key T3 in lingua it -- Value: Definizione tre >> > You need to overload the == operator and the hash method. > > class Termine > alias eql? == > def ==(other) > descrizione == other.descrizione and lingua == other. lingua > end > def hash > (descrizione + lingua).hash > end > end > > t = Termine.new("Hi") > t2 = Termine.new("Hi") > > t == t2 #=> true > > h = {} > h[t] = "short hello" > h #=> {#<Termine:0x24a22c @lingua="it", @descrizione="Hi">=>"short > hello"} > h.has_key?(t2) #=> true Thank for your help... this is that I need... --Andrea -- Posted via http://www.ruby-forum.com/.