From: Eric Schwartz Date: 2006-10-04T07:05:06+09:00 Subject: Re: Using Each to Iterate A very minor comment: "Jeff Nyman" writes: > def [](index) > @guides[index] if index.kind_of?(Integer) > end I think you're doing yourself a disservice here. Remember duck typing! If you pass something that's not a kind_of?(Integer), then you don't raise any errors at all, and users of your code, even if that's just you, won't get a warning that they did something silly. The result (or in this case, lack of one) might percolate a ways up the call chain until something bad happens. Much better to just def [](index) @guides[index] end or even def [](index) @guides[index.to_i] end That way, if you pass something that can't be converted into an Integer easily, you'll find out closest to where the problem actually occurs. -=Eric