Newbie question on RDoc--top-level functions


#1

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


#2

On Nov 4, 4:18 pm, Kenneth McDonald removed_email_address@domain.invalid
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.


#3

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: