using rdoc to document dynamically-generated classes


P

Paul Brannan

I have a number of classes that are dynamically generated at the time my
extension is loaded. Is there an easy way to get rdoc to generate
documentation for these classes? It doesn't seem to do anything by
default.

One solution I know of is to generate the .c file statically (so instead
of generating the classes using a loop in C, I generate C code using a
loop in Ruby). I'd rather not go this route unless I have to.

Also, does a similar solution exist for pure ruby code?

Paul
 
Ad

Advertisements

D

Dave Thomas

I have a number of classes that are dynamically generated at the time
my
extension is loaded. Is there an easy way to get rdoc to generate
documentation for these classes? It doesn't seem to do anything by
default.

One solution I know of is to generate the .c file statically (so
instead
of generating the classes using a loop in C, I generate C code using a
loop in Ruby). I'd rather not go this route unless I have to.

If you're writing in 'C', and if you know the names ofthe classes
you're generating, you can use

/*
* Document-class: DynamicClass
*
* Documentation
* goes here
*/

Also, does a similar solution exist for pure ruby code?

Not at the moment.

Cheers

Dave
 
P

Paul Brannan

If you're writing in 'C', and if you know the names ofthe classes
you're generating, you can use

/*
* Document-class: DynamicClass
*
* Documentation
* goes here
*/

How do I document the methods of the class using this technique?

Paul
 
D

Dave Thomas

How do I document the methods of the class using this technique?

That's difficult, because presumably you're using the same method body
in multiple classes.

I'm open to suggestions... :))

Cheers

Dave
 
Ad

Advertisements

P

Paul Brannan

That's difficult, because presumably you're using the same method body
in multiple classes.

I'm open to suggestions... :))

I will have to think about this for a while. It's definitely not
trivial. My first inclination is perhaps a special markup code that
would let me embed a ruby script in my source that interfaces with
rdoc's API to dynamically generate the documentation. Not clean to
write documentation this way, but it would allow me to generate the
documentation programmatically.

This might also be possible without modification to rdoc.

Paul
 

Top