summaryrefslogtreecommitdiffstats
path: root/lib/models/readme.js
blob: c655c82180d88cbaf8864e89bc5e64c1824002ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var Immutable = require('immutable');

var File = require('./file');

var Readme = Immutable.Record({
    file:           File(),
    title:          String(),
    description:    String()
});

Readme.prototype.getFile = function() {
    return this.get('file');
};

Readme.prototype.getTitle = function() {
    return this.get('title');
};

Readme.prototype.getDescription = function() {
    return this.get('description');
};

/**
    Create a new readme

    @param {File} file
    @param {Object} def
    @return {Readme}
*/
Readme.create = function(file, def) {
    def = def || {};

    return new Readme({
        file: file,
        title: def.title || '',
        description: def.description || ''
    });
};

module.exports = Readme;