Paul Lutus wrote: > Blake Miller wrote: > >> @components << component >> end >> >> def component(uniqueId) # note: uniqueId is a string > > What? "uniqueId" is string? It cannot be a string, it has to be an ID, > something gotten with ".object_id", nothing else will do. And two > strings > with the same content do not necessarily have the same ID. > > In your method "uniqueId", you should be returning "self.object_id". > > In your code, I do not see where you acquire the ".object_id" of any > object. > > Very basically, in order to solve a problem like this, you simply must > post > a short, terse, concise bit of code, that (1) can be run by a newsgroup > reader, and (2) shows the problem. > > Posting bits and pieces of code, but never a short working example, is a > sure way to assure that this thread will go on forever. Why can't it be a string, I can use whatever I want to identify an object. Now, if you're saying it's not possible to compare two strings, then I'd see your point. I can't make the code any simpler without sacrificing understanding of what I'm trying to accomplish. It's very simple, each component has an id, a unique id, that I assign to it, which is a string, and is unique (I'll enforce that later). I have an array of these components, and I want to search that array given a string to find the matching component by id. -- Posted via http://www.ruby-forum.com/.