Show Private and Protected methods

's Avatar


08 Jan, 2011 07:05 PM

Can you add private and protected methods to the generated rdocs? It would save me the trouble of having to open the gem to see the source.

  1. Support Staff 1 Posted by lsegal on 08 Jan, 2011 08:31 PM

    lsegal's Avatar

    Private and protected methods get displayed when the correct switches are set in the .yardopts file of the project-- this is decided on by the project/library maintainers, since they know best what information is relevant to the readers. It would be presumptuous of us to make this decision for them, since some library maintainers are very specific about what information they want to be shown.

    In any case, you should never have to read up on private methods, because you should never have to use them in the first place. isn't really meant to be a source browsing tool, so if that's really what you need, viewing the source is much more effective anyway. Sorry that we can't do much for you, there.

  2. lsegal closed this discussion on 08 Jan, 2011 08:31 PM.

  3. Steven Bristol re-opened this discussion on 11 Jan, 2011 04:51 PM

  4. 2 Posted by Steven Bristol on 11 Jan, 2011 04:51 PM

    Steven Bristol's Avatar

    What do you care what the authors want? I thought this was a tool for users of the gems, not the authors. You can make it as cool as you want. You could have a button to show/hide private/protected methods and then your site is way more awesome!!

  5. Support Staff 3 Posted by lsegal on 11 Jan, 2011 09:10 PM

    lsegal's Avatar

    Hi Steven,

    We care about both users and gem authors alike. is as much a way for users to read documentation as it is a place for gem authors to make their documentation available. We are treated as the official documentation source for at least a few widely published gems, which means we do need to keep authors' interests in mind.

    FWIW, even if we forced the displaying of protected/private methods, they would likely be undocumented for the most part (since the gem authors generally concentrate on documenting what is shown in public documentation only), so there would not be much for the documentation tool to show besides some method names.'s goal is not to become a repository for source code, but a repository for documentation, so displaying undocumented code is not really in our interests. As I pointed out, if reading source is your ultimate goal, YARD and are no competition for just loading up the source in your favourite editor-- or even browse the source on the repository websites directly (read: github).

    edit: I should add, if you find yourself needing to use private/protected methods often-- perhaps you should bring this up with the gem maintainers themselves, as it might mean there are issues with their API separation, or they overused private visibility. They would probably be interested in hearing about this, too, since it would improve the gem for other users who need to do what you are doing.

  6. lsegal closed this discussion on 11 Jan, 2011 09:10 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac