List Info

Thread: Re: Creating objects from classes I don't know beforehand




Re: Creating objects from classes I don't know beforehand
country flaguser name
France
2007-08-19 06:12:43
Eyal Oren a écrit :
> On 08/19/07/08/07 12:32 +0200, Damaris Fuentes wrote:
>> Hi all,
>>   I'm trying to create an instance of a class, but
I don't know this
>> class beforehand. So I have the namespace (let's
say, ":foaf"), and a
>> variable with the class localname. I can obtain the
complete uri with
>> class_uri = Namespace.lookup(:foaf, my_var), but I
don't really know
>> how to make an instance with this ( and my_instance
=
>> class_uri.new.... does not work  )
> Use Ruby's 'send' method:
> my_instance = class_uri.send(:new, 'uri...')
The above code doesn't work for me ? This does:

ObjectManager.construct_class(class_uri).new...

-- Yoan
>
>  -eyal
> _______________________________________________
> ActiveRDF mailing list
> ActiveRDFlists.deri.org
> http
://lists.deri.org/mailman/listinfo/activerdf
_______________________________________________
ActiveRDF mailing list
ActiveRDFlists.deri.org
http
://lists.deri.org/mailman/listinfo/activerdf

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )