SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: How to RDOC

  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to RDOC

    I should have been using RDOC earlier, but I guess better late than never.

    It seems fairly simple to generate RDOC documentation in a Rails application:
    Code:
    rake appdoc
    However, I understand that RDOC has the facility to detect comments in the code and add them to the documentation pages. However, I can't see how to either tell RDOC to include my comments, or flag the comments so that RDOC will use them. How do I get RDOC to identify and post my comments into the documentation?

    Finding a solution isn't helped by the fact that seaching for help on RDOC documentation leads to lots of links to documentation created with RDOC.

  2. #2
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Type "rdoc help" for an up-to-date option summary.
    http://www.ruby-doc.org/stdlib/libdoc/rdoc/rdoc/

    All I could find for you...

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I've cracked it. I had a look at rdoc.rb and the way that was set up and I've worked out what I was doing wrong. I was writing my code like this:
    Code:
    def a_method
      #Comment describing the method
      .... bit of code ....
    end
    For RDoc to detect the comment it needs to be outside of and before the method statement. For example:
    Code:
    #Comment describing the method
    def a_method
      .... bit of code ....
    end
    Perhaps I should have known that, but I could not find documentation stating that was where the method comments should go, but now I know.

  4. #4
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh nice, one!

    I love it when a plan comes together

  5. #5
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •