index.js
function (name, opts, loaders) {
    var args = utils.slice(arguments, 1);
    opts = lazy.clone(args.shift());
    loaders = args;

    var single = lazy.inflect.singularize(name);
    var plural = lazy.inflect.pluralize(name);
    this.inflections[single] = plural;

    if (typeof opts.renameKey === 'undefined' && this.options.renameKey) {
      opts.renameKey = this.options.renameKey;
    }

    opts.plural = plural;
    opts.inflection = single;
    opts.loaders = loaders;
    opts.app = this;
    opts = lazy.extend({}, opts, this.options);

    if (!opts.loaderType) {
      opts.loaderType = 'sync';
    }

    var Views = this.get('Views');
    var views = new Views(opts);
    this.viewType(plural, views.viewType());

    // add custom View constructor for collection items
    var ViewClass = viewFactory(single, opts);
    var classKey = single[0].toUpperCase() + single.slice(1);
    this.define(classKey, ViewClass);

    // init the collection object on `views`
    this.views[plural] = views;
    this.loader(plural, opts, loaders);

    // wrap loaders to expose the collection and opts
    utils.defineProp(opts, 'wrap', views.wrap.bind(views, opts));
    opts.defaultLoader = opts.defaultLoader || 'default';

    // create the actual loader function
    var fn = this.compose(plural, opts);
    views.forward(fn, ['forOwn']);

    // forward collection methods onto loader
    utils.setProto(fn, views);

    // add loader methods to the instance: `app.pages()`
    this.mixin(single, fn);
    this.mixin(plural, fn);

    // decorate named loader methods back to the collection
    // to allow chaining like `.pages().pages()` etc
    utils.defineProp(views, plural, fn);
    utils.defineProp(views, single, fn);

    // add collection and view (item) helpers
    helpers.collection(this, views, opts);
    helpers.view(this, views, opts);
    return this;
  }
function (name, opts, loaders) {
    var args = utils.slice(arguments, 1);
    opts = lazy.clone(args.shift());
    loaders = args;

    var single = lazy.inflect.singularize(name);
    var plural = lazy.inflect.pluralize(name);
    this.inflections[single] = plural;

    if (typeof opts.renameKey === 'undefined' && this.options.renameKey) {
      opts.renameKey = this.options.renameKey;
    }

    opts.plural = plural;
    opts.inflection = single;
    opts.loaders = loaders;
    opts.app = this;
    opts = lazy.extend({}, opts, this.options);

    if (!opts.loaderType) {
      opts.loaderType = 'sync';
    }

    var Views = this.get('Views');
    var views = new Views(opts);
    this.viewType(plural, views.viewType());

    // add custom View constructor for collection items
    var ViewClass = viewFactory(single, opts);
    var classKey = single[0].toUpperCase() + single.slice(1);
    this.define(classKey, ViewClass);

    // init the collection object on `views`
    this.views[plural] = views;
    this.loader(plural, opts, loaders);

    // wrap loaders to expose the collection and opts
    utils.defineProp(opts, 'wrap', views.wrap.bind(views, opts));
    opts.defaultLoader = opts.defaultLoader || 'default';

    // create the actual loader function
    var fn = this.compose(plural, opts);
    views.forward(fn, ['forOwn']);

    // forward collection methods onto loader
    utils.setProto(fn, views);

    // add loader methods to the instance: `app.pages()`
    this.mixin(single, fn);
    this.mixin(plural, fn);

    // decorate named loader methods back to the collection
    // to allow chaining like `.pages().pages()` etc
    utils.defineProp(views, plural, fn);
    utils.defineProp(views, single, fn);

    // add collection and view (item) helpers
    helpers.collection(this, views, opts);
    helpers.view(this, views, opts);
    return this;
  }
function ( name , opts , loaders ) { var args = utils . slice ( arguments , 1 ) ; opts = lazy . clone ( args . shift ( ) ) ; loaders = args ; var single = lazy . inflect . singularize ( name ) ; var plural = lazy . inflect . pluralize ( name ) ; this . inflections [ single ] = plural ; if ( typeof opts . renameKey === 'undefined' && this . options . renameKey ) { opts . renameKey = this . options . renameKey ; } opts . plural = plural ; opts . inflection = single ; opts . loaders = loaders ; opts . app = this ; opts = lazy . extend ( { } , opts , this . options ) ; if ( ! opts . loaderType ) { opts . loaderType = 'sync' ; } var Views = this . get ( 'Views' ) ; var views = new Views ( opts ) ; this . viewType ( plural , views . viewType ( ) ) ; // add custom View constructor for collection items var ViewClass = viewFactory ( single , opts ) ; var classKey = single [ 0 ] . toUpperCase ( ) + single . slice ( 1 ) ; this . define ( classKey , ViewClass ) ; // init the collection object on `views` this . views [ plural ] = views ; this . loader ( plural , opts , loaders ) ; // wrap loaders to expose the collection and opts utils . defineProp ( opts , 'wrap' , views . wrap . bind ( views , opts ) ) ; opts . defaultLoader = opts . defaultLoader || 'default' ; // create the actual loader function var fn = this . compose ( plural , opts ) ; views . forward ( fn , [ 'forOwn' ] ) ; // forward collection methods onto loader utils . setProto ( fn , views ) ; // add loader methods to the instance: `app.pages()` this . mixin ( single , fn ) ; this . mixin ( plural , fn ) ; // decorate named loader methods back to the collection // to allow chaining like `.pages().pages()` etc utils . defineProp ( views , plural , fn ) ; utils . defineProp ( views , single , fn ) ; // add collection and view (item) helpers helpers . collection ( this , views , opts ) ; helpers . view ( this , views , opts ) ; return this ; }
Create a new `Views` collection.

```js
app.create('foo');
app.foo('*.hbs');
var view = app.foo.get('baz.hbs');
```

@name .create
@param  {String} `name` The name of the collection. Plural or singular form.
@param  {Object} `opts` Collection options
@param  {String|Array|Function} `loaders` Loaders to use for adding views to the created collection.
@return {Object} Returns the `Assemble` instance for chaining.
@api public
Create a new Views collection .