Search code examples
javascriptdocumentationyuidoc

yuidoc - how to define a class method in an other file


I'm writing documentation with yuidoc. However, I have a class Model, which has one of its methods defined elsewhere. Here is some code to visualize the situation. Assume I have a file model.js:

/**
 * @class Model
 * @constructor
 */
 window.Model = function(){}
 ....

And a file activerecord.js:

(function(){
    /**
     * @class ActiveRecord
     * @constructor
     window.ActiveRecord = function(){}
     ....
     /**
      * @method Model.hasMany
      * @param {Class} model
      */
     function hasMany(model) {}
})() ;

As you can see, the method 'hasMany' should show up under the class documentation of Model. However, it doesn't. Is something like this possible ?

Thanks a lot


Solution

  • See the @for tag: http://yui.github.io/yuidoc/syntax/index.html#for

    /**  
     * Some method "hasMany" disconnected from its class "Model".
     * 
     * @method hasMany  
     * @for Model
     * @param {Class} model 
     */
    function hasMany(model) {}