> I tried setting a variable like : > def getXById(id) > inst = X.new > @ys.each_with_index do |comp, index| > if( @ys[index].getUniqueId == id ) > inst = @ys.fetch(index) > end > end > > inst > end > > ...but I'm not looking to instantiate a new X, and even that solution > seems to screw up the @ys array. I've also tried this: def getXById(id) matchingIndx = 0 @components.each_index do |index| if( @components[index].getUniqueId == uniqueId ) matchingIndx = index end end @components.fetch(matchingIndx) end but it just returns the 0th one every time (I'm assuming there wasn't a match) -- Posted via http://www.ruby-forum.com/.