Newbie question on RDoc--top-level functions

How do I get a top-level function (one not defined inside a class) to
show up in RDoc output. I have a number of such functions, and they
don’t appear to be showing up anywhere.

Thanks,
Ken

On Nov 4, 4:18 pm, Kenneth McDonald [email protected]
wrote:

How do I get a top-level function (one not defined inside a class) to
show up in RDoc output. I have a number of such functions, and they
don’t appear to be showing up anywhere.

Not really a good practice in any case.

You can just move them to Object, which is effectively the same
(except public vs. private):

class Object
# … methods here
end

If you consider them general purpose core extensions then Kernel may
be more appropriate:

module Kernel
# … methods here
end

T.

On Nov 4, 2008, at 13:18 , Kenneth McDonald wrote:

How do I get a top-level function (one not defined inside a class)
to show up in RDoc output. I have a number of such functions, and
they don’t appear to be showing up anywhere.

global methods get added to Object as private methods, but rdoc
doesn’t automatically file them in Object (I’m filing a bug on that).
They do show up in the method list:

Public Instance methods
x()
this is my rdoc

Here I’m creating a new project, throwing a global method in the file,
and generating rdoc:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs