Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

show-doc for generated methods and attributes. #839

Open
codesnik opened this Issue Jan 31, 2013 · 4 comments

Comments

Projects
None yet
3 participants

Is there currently any way to document metaprogrammed methods?

I'd really like to document, for example, activerecord attributes of rails models in a way accessible to "? Model#attribute" command.

Of course, I can write something like that:

class Order < ActiveRecord::Base
   # price in US dollars
   def price; super; end
end

but is there (planned?) any other, more elegant and less performance degrading way?

Owner

ConradIrwin commented Feb 1, 2013

@codesnik. This is not currently planned, though I agree it would be pretty nice. In the specific case of activerecord it might be that pry-rails show-models command can help you a little; but I suspect it would need a lot of work.

Can you think of a solution that would work both in more general situations? What does YARD do for stuff like this?

Contributor

rking commented Feb 1, 2013

YARD has features like crazy. If I found docs to be of frequent value I'd be impressed by it. Anyway, see these for example:

http://rubydoc.info/docs/yard/file/docs/Tags.md#List_of_Available_Tags

http://yardoc.org/guides/extending-yard/writing-handlers.html

codesnik commented Feb 1, 2013

it looks like YARD @!method and @!attribute tags are exactly for that purpose.

http://rubydoc.info/docs/yard/file/docs/Tags.md#method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment