I'm too lazy to figure it out (and a bit hangover).
I have several collections of objects (read over an OLE API) that I 
transform to arrays of ruby objects.
Against the DRY religion I ended up with several methods similar to the 
following:

def get_processors col
	ar=Array.new
	count=col.Count
	1.upto(count){|i|
		ar<<Processor.new(col.GetAt(i))
	}
	return ar
end

Now, this begs for the working equivalent of

def get_collection col, _class
	ar=Array.new
	count=col.Count
	1.upto(count){|i|
		ar<<_class.new(col.GetAt(i))
	}
	return ar
end

How do I do it?
(I do know how do it - I think . It's just that the hangover is not 
helping the search functions of my brain :) )

i.e. this would do what I want
def get_collection col, _class
	ar=Array.new
	count=col.Count
	1.upto(count){|i|
		ar<<instance_eval(_class+".new(col.GetAt(i))")
	}
	return ar
end

...but, is there another way?
Cheers,
V.-
-- 
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.