Extending an object


#1

I’m writing an extension for Ruby, and want to extend an object with
methods from a module. I’m doing it like this:

rb_extend_object(self, rb_mAModuleExtension);

But the methods added to self become private. I want them public. How
should this be done?

Thanks in advance.


Gerardo S.
“Between individuals, as between nations, respect for the rights of
others is peace” - Don Benito Juárez


#2

On Mon, 2006-02-27 at 16:16 +0900, Gerardo S. Gómez Garrido wrote:

I’m writing an extension for Ruby, and want to extend an object with
methods from a module. I’m doing it like this:

rb_extend_object(self, rb_mAModuleExtension);

But the methods added to self become private. I want them public. How
should this be done?

I think rb_extend_object retains the original access of module instance
methods, so you should need to just define them public in the module
you’re extending.


#3

Thanks Ross, it’s solved. For the record, I was using
rb_define_module_function insted of rb_define_method for defining a
method in the module.

2006/2/27, Ross B. removed_email_address@domain.invalid:

methods, so you should need to just define them public in the module
you’re extending.


Ross B. - removed_email_address@domain.invalid


Gerardo S.
“Between individuals, as between nations, respect for the rights of
others is peace” - Don Benito Juárez