extending an object

  • Thread starter Gerardo Santana Gómez Garrido
  • Start date
G

Gerardo Santana Gómez Garrido

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.
 
R

Ross Bamford

I'm writing an extension for Ruby, and want to extend an object with
methods from a module. I'm doing it like this:
=20
rb_extend_object(self, rb_mAModuleExtension);
=20
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.

--=20
Ross Bamford - (e-mail address removed)
 
G

Gerardo Santana Gómez Garrido

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top