From: "Peña, Botp" Date: 2005-06-01T18:35:05+09:00 Subject: Re: array of object insert polices dave [mailto:dave.m@email.it] wrote: #and what if an user does x[2] = "i'm an integer :)" You have to redefine all the others, too. Eg, add this to integer array .... def []= (index, other) p "You entered #{other} thru index #{index}" if other.class == Fixnum p "That's an integer you're inserting. go!" super index, other # call original insert method << else p "nope: i'm sorry, only integers allowed" end end .... irb(main):004:0> x[2]=2 "You entered 2 thru index 2" "That's an integer you're inserting. go!" => 2 irb(main):005:0> x[3]="testing" "You entered testing thru index 3" "nope: i'm sorry, only integers allowed" => "testing" It gets uglier as you go on :-) .... So you may have to listen to RobertK's idea also. thanks and kind regards -botp