2007/3/23,
<>:
> Are comment blocks objects? I want to be able to access all (or just
> one) the comment blocks for an object. Then I can make a .help for
> each object.
I've stripped the implementation details. To make a simple answer,
ruby simply ignores the comments when parsing the source code. So the
comments are not available to the ruby interpreter. However, you can
either re-parse the open files or use the ri indexes to fetch the
according methods. Mauricio Fernandez[1] has done some nice job[2] on
comment indexing and methods lookup, based on the initial RDoc work.
If I where you, I would look at that first. Secondly, I think that
there already is a help.rb file in the stdlib that does what you want,
or at least a gem is flying around here.
I hope this helps you go further with your investigations
--
Cheers,
zimbatm
[1] :
http://eigenclass.org
[2] :
http://rubyforge.org/projects/fastri/