1 |
|
2 | (function() {
|
3 | var RuleBook;
|
4 |
|
5 | RuleBook = (function() {
|
6 | function RuleBook() {
|
7 | this.rules = [];
|
8 | this.closed = false;
|
9 | }
|
10 |
|
11 | RuleBook.prototype.addRule = function(rule) {
|
12 | if (this.closed) {
|
13 | throw new Error('RuleBook is already closed, ' + 'you can\'t add rules anymore');
|
14 | }
|
15 | if (rule != null) {
|
16 | return this.rules.push(rule);
|
17 | }
|
18 | };
|
19 |
|
20 | RuleBook.prototype.close = function() {
|
21 | return this.closed = true;
|
22 | };
|
23 |
|
24 | RuleBook.prototype.getRules = function() {
|
25 | return this.rules;
|
26 | };
|
27 |
|
28 | return RuleBook;
|
29 |
|
30 | })();
|
31 |
|
32 | module.exports = RuleBook;
|
33 |
|
34 | }).call(this);
|