# Newbie question on RDoc--top-level functions

**URL:** <https://www.ruby-forum.com/t/newbie-question-on-rdoc-top-level-functions/152530>\
**Category:** Ruby\
**Created:** [November 4, 2008, 10:22pm UTC](https://www.ruby-forum.com/t/newbie-question-on-rdoc-top-level-functions/152530 "2008-11-04T22:22:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [November 4, 2008, 10:22pm UTC](https://www.ruby-forum.com/t/newbie-question-on-rdoc-top-level-functions/152530/1 "2008-11-04T22:22:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [November 4, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/newbie-question-on-rdoc-top-level-functions/152530/2 "2008-11-04T23:43:38Z")

</div>

On Nov 4, 4:18 pm, Kenneth McDonald [removed\_email\_address@domain.invalid](mailto: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.

---

<div class="post-metadata">

**Author:** ![Kenneth\_McDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dc4da7/32.png) [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Post date:** [November 5, 2008, 12:04am UTC](https://www.ruby-forum.com/t/newbie-question-on-rdoc-top-level-functions/152530/3 "2008-11-05T00:04:45Z")

</div>

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:
