I'm using YARD on my Rails project and was wondering how I would go about documenting inherited/runtime methods on a Rails model? For instance documenting the existence of a first_name
attribute on a User
model.
Asked
Active
Viewed 366 times
3

capotej
- 2,861
- 3
- 21
- 16
-
http://gilesbowkett.blogspot.com/2008/02/activerecord-ruby2ruby-this-is-where.html Ruby2Ruby might be helpful, but you'd have to make up your own rdoc generating workflow, `gem rdoc your_project` most likely wouldn't work unless you did some crazy fork of rdoc. – Tim Snowhite Apr 08 '11 at 15:50
1 Answers
0
You can't do that, IMHO.
The trouble is that those methods don't really "exist"; They are "created on the fly" via method_missing
hooks, the first time they are invoked, on runtime.
Other documentation generation systems have ways to declare "implicit" methods. For example NaturalDocs has a function keyword that allows you to create functions that only exist on the comments. I'm not familiar enough with YARD, but it seems it doesn't have a similar functionality.
Good luck!

kikito
- 51,734
- 32
- 149
- 189