I'm using YARD on my Rails project and was wondering how I would go about documen开发者_JS百科ting inherited/runtime methods on a Rails model? For instance documenting the existence of a first_name
attribute on a User
model.
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!
精彩评论