diff --git a/lib/base.js b/lib/base.js index 23f5e9f..820f4a3 100644 --- a/lib/base.js +++ b/lib/base.js @@ -51,28 +51,8 @@ function Base(options) { if (typeof this.options.mixins === 'object') { this.visit('mixin', this.options.mixins); } - // this.cache = this.cache || {}; } -/** - * - * Expose `extend`, static method for allowing other classes to inherit - * from the `Base` class (and receive all of Base's prototype methods). - * - * ```js - * function MyClass(options) {...} - * Base.extend(MyClass); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `Base` - * @return {undefined} - * @api public - */ - -Base.extend = function (obj) { - util.inherits(obj, Base); -}; - /** * `Base` prototype methods */ @@ -391,6 +371,25 @@ Base.prototype = Emitter({ } }); +/** + * + * Expose `extend`, static method for allowing other classes to inherit + * from the `Base` class (and receive all of Base's prototype methods). + * + * ```js + * function MyClass(options) {...} + * Base.extend(MyClass); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `Base` + * @return {undefined} + * @api public + */ + +Base.extend = function (obj) { + util.inherits(obj, Base); +}; + /** * Expose `Base` */ diff --git a/lib/collection.js b/lib/collection.js index bd8a720..96e8183 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -72,25 +72,6 @@ function Collection(options) { Base.extend(Collection); -/** - * - * Expose `extend`, static method for allowing other classes to inherit - * from the `Collection` class (and receive all of Collection's prototype methods). - * - * ```js - * function MyCustomCollection(options) {...} - * Collection.extend(MyCustomCollection); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `Collection` - * @return {undefined} - * @api public - */ - -Collection.extend = function(obj) { - util.inherits(obj, Collection); -}; - /** * `Collection` prototype methods */ @@ -216,6 +197,25 @@ utils.delegate(Collection.prototype, { } }); +/** + * + * Expose `extend`, static method for allowing other classes to inherit + * from the `Collection` class (and receive all of Collection's prototype methods). + * + * ```js + * function MyCustomCollection(options) {...} + * Collection.extend(MyCustomCollection); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `Collection` + * @return {undefined} + * @api public + */ + +Collection.extend = function(obj) { + util.inherits(obj, Collection); +}; + /** * Expose `Collection` */ diff --git a/lib/file.js b/lib/file.js index 46af900..98430d0 100644 --- a/lib/file.js +++ b/lib/file.js @@ -36,24 +36,6 @@ function File(file, options) { Item.extend(File); -/** - * Expose `extend`, to allow other classes to inherit - * from the `File` class. - * - * ```js - * function MyCustomFile(options) {...} - * File.extend(MyCustomFile); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `File` - * @return {undefined} - * @api public - */ - -File.extend = function (Ctor) { - util.inherits(Ctor, File); -}; - /** * `File` prototype methods */ @@ -154,6 +136,24 @@ Object.defineProperty(File.prototype, 'layout', { } }); +/** + * Expose `extend`, to allow other classes to inherit + * from the `File` class. + * + * ```js + * function MyFile(options) {...} + * File.extend(MyFile); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `File` + * @return {undefined} + * @api public + */ + +File.extend = function (Ctor) { + util.inherits(Ctor, File); +}; + /** * Expose `File` */ diff --git a/lib/item.js b/lib/item.js index d830e55..458613e 100644 --- a/lib/item.js +++ b/lib/item.js @@ -32,25 +32,6 @@ function Item(item, options) { Base.extend(Item); -/** - * - * Expose `extend`, static method for allowing other classes to inherit - * from the `Item` class (and receive all of Item's prototype methods). - * - * ```js - * function MyCustomItem(options) {...} - * Item.extend(MyCustomItem); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `Item` - * @return {undefined} - * @api public - */ - -Item.extend = function(obj) { - util.inherits(obj, Item); -}; - /** * `Item` prototype methods */ @@ -167,6 +148,25 @@ utils.delegate(Item.prototype, { } }); +/** + * + * Expose `extend`, static method for allowing other classes to inherit + * from the `Item` class (and receive all of Item's prototype methods). + * + * ```js + * function MyItem(options) {...} + * Item.extend(MyItem); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `Item` + * @return {undefined} + * @api public + */ + +Item.extend = function(obj) { + util.inherits(obj, Item); +}; + /** * Expose `Item` */ diff --git a/lib/list.js b/lib/list.js index c6e93b4..e4c0789 100644 --- a/lib/list.js +++ b/lib/list.js @@ -48,24 +48,6 @@ function List(options) { Base.extend(List); -/** - * Expose `extend`, to allow other classes to inherit - * from the `List` class. - * - * ```js - * function MyCustomList(options) {...} - * List.extend(MyCustomList); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `List` - * @return {undefined} - * @api public - */ - -List.extend = function(Ctor) { - util.inherits(Ctor, List); -}; - /** * `List` prototype methods */ @@ -178,6 +160,24 @@ utils.delegate(List.prototype, { }, }); +/** + * Expose `extend`, to allow other classes to inherit + * from the `List` class. + * + * ```js + * function MyList(options) {...} + * List.extend(MyList); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `List` + * @return {undefined} + * @api public + */ + +List.extend = function(Ctor) { + util.inherits(Ctor, List); +}; + /** * Expose `List` */ diff --git a/lib/lookup.js b/lib/lookup.js index a73fa1e..42a3419 100644 --- a/lib/lookup.js +++ b/lib/lookup.js @@ -10,10 +10,10 @@ module.exports = function (app) { * that matches the given glob pattern. * * ```js - * var pages = template.matchView('pages', 'home.*'); + * var pages = app.matchView('pages', 'home.*'); * //=> {'home.hbs': { ... }, ...} * - * var posts = template.matchView('posts', '2010-*'); + * var posts = app.matchView('posts', '2010-*'); * //=> {'2015-10-10.md': { ... }, ...} * ``` * @@ -37,10 +37,10 @@ module.exports = function (app) { * that match the given glob pattern. * * ```js - * var pages = template.matchViews('pages', 'home.*'); + * var pages = app.matchViews('pages', 'home.*'); * //=> {'home.hbs': { ... }, ...} * - * var posts = template.matchViews('posts', '2010-*'); + * var posts = app.matchViews('posts', '2010-*'); * //=> {'2015-10-10.md': { ... }, ...} * ``` * @@ -60,7 +60,7 @@ module.exports = function (app) { * Get a specific template from the specified collection. * * ```js - * template.getView('pages', 'a.hbs', function(fp) { + * app.getView('pages', 'a.hbs', function(fp) { * return path.basename(fp); * }); * ``` @@ -97,10 +97,10 @@ module.exports = function (app) { * Get a view `collection` by its singular or plural name. * * ```js - * var pages = template.getViews('pages'); + * var pages = app.getViews('pages'); * //=> { pages: {'home.hbs': { ... }} * - * var posts = template.getViews('posts'); + * var posts = app.getViews('posts'); * //=> { posts: {'2015-10-10.md': { ... }} * ``` * diff --git a/lib/views.js b/lib/views.js index 6054fca..c804e60 100644 --- a/lib/views.js +++ b/lib/views.js @@ -36,24 +36,6 @@ function Views(options) { Collection.extend(Views); -/** - * Expose `extend`, to allow other classes to inherit - * from the `Views` class. - * - * ```js - * function MyCustomViews(options) {...} - * Views.extend(MyCustomViews); - * ``` - * - * @param {Object} `Ctor` Constructor function to extend with `Views` - * @return {undefined} - * @api public - */ - -Views.extend = function (obj) { - util.inherits(obj, Views); -}; - /** * `Views` prototype methods */ @@ -231,6 +213,24 @@ utils.delegate(Views.prototype, { } }); +/** + * Expose `extend`, to allow other classes to inherit + * from the `Views` class. + * + * ```js + * function MyViews(options) {...} + * Views.extend(MyViews); + * ``` + * + * @param {Object} `Ctor` Constructor function to extend with `Views` + * @return {undefined} + * @api public + */ + +Views.extend = function (obj) { + util.inherits(obj, Views); +}; + /** * Expose `Views` */