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

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, 4:18 pm, Kenneth McDonald <kenneth.m.mcdon...@sbcglobal.net> 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.

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:

···

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

% sow blah
creating project blah
... done, now go fix all occurrences of 'FIX'

  blah/Rakefile:9: # p.developer('FIX', 'FIX@example.com')
  blah/README.txt:3:* FIX (url)
  blah/README.txt:7:FIX (describe your package)
  blah/README.txt:11:* FIX (list of features or problems)
  blah/README.txt:15: FIX (code sample of usage)
  blah/README.txt:19:* FIX (list of requirements)
  blah/README.txt:23:* FIX (sudo gem install, anything else)
  blah/README.txt:29:Copyright (c) 2008 FIX

% cd blah
./blah

% echo "
>
> ##
> # this is my rdoc
>
> def x
> 42
> end" >> lib/blah.rb

% cat !$
cat lib/blah.rb
class Blah
  VERSION = '1.0.0'
end

##
# this is my rdoc

def x
42
end

% rake docs
(in /Users/ryan/blah)
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
rm -r doc

                        History.txt:
                         README.txt:
                               blah:
                            blah.rb: c.
Generating HTML...
Diagrams: ..

Files: 4
Classes: 1
Modules: 0
Methods: 1
Elapsed: 1.075s