mustachejs-rails 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 261849b7cde04e47f0e4cdb9f618c1983119eb29
4
- data.tar.gz: 9c8df312fa1c187a99ff193c4c4ede273eca347a
3
+ metadata.gz: 30b027e628a3d7cb5eb041fb73b787e0a1f475fb
4
+ data.tar.gz: 066a7094d0c64d2c6ab7893b24015dbba11828e2
5
5
  SHA512:
6
- metadata.gz: cd1c7cf447c12ebf8ec8bc0bb8850efd384bf7c5e25a61b9d55b2c2296301d6eb6a912a4c703e25c6f7912aaffe7052514be4cd8695bba794d3019855a96aa5e
7
- data.tar.gz: 5c0919257f04c57544863c1353b456cff98f95c8fd5f5206b62b2d613e673a872ee97cf35195067db14ee66335a6baa561ba3f65486f3616291384769e7fcd26
6
+ metadata.gz: 6c8436eaf5e16de466152fa90e8a567cce981a49383d82d47233af25556541e98f481ae1f238fe9f8f4e3b496407f527b4455716dbe334cb791207434dd64b83
7
+ data.tar.gz: b5090be7f8eac1ea1627eee6542000cc5e8f9216cf9c039e2fd1d5589b7cec8851b0e7b8dcafc2c58fcef58e4d11ff2195d633acf581eeb376b54d80ac4c0b2b
@@ -1,5 +1,5 @@
1
1
  module Mustachejs
2
2
  module Rails
3
- VERSION = "0.7.2"
3
+ VERSION = "0.7.3"
4
4
  end
5
5
  end
@@ -7,23 +7,17 @@
7
7
 
8
8
  (function (root, factory) {
9
9
  if (typeof exports === "object" && exports) {
10
- module.exports = factory; // CommonJS
11
- } else if (typeof define === "function" && define.amd) {
12
- define(factory); // AMD
10
+ factory(exports); // CommonJS
13
11
  } else {
14
- root.Mustache = factory; // <script>
12
+ var mustache = {};
13
+ factory(mustache);
14
+ if (typeof define === "function" && define.amd) {
15
+ define(mustache); // AMD
16
+ } else {
17
+ root.Mustache = mustache; // <script>
18
+ }
15
19
  }
16
- }(this, (function () {
17
-
18
- var exports = {};
19
-
20
- exports.name = "mustache.js";
21
- exports.version = "0.7.2";
22
- exports.tags = ["{{", "}}"];
23
-
24
- exports.Scanner = Scanner;
25
- exports.Context = Context;
26
- exports.Writer = Writer;
20
+ }(this, function (mustache) {
27
21
 
28
22
  var whiteRe = /\s*/;
29
23
  var spaceRe = /\s+/;
@@ -34,19 +28,25 @@
34
28
 
35
29
  // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
36
30
  // See https://github.com/janl/mustache.js/issues/189
37
- function testRe(re, string) {
38
- return RegExp.prototype.test.call(re, string);
31
+ var RegExp_test = RegExp.prototype.test;
32
+ function testRegExp(re, string) {
33
+ return RegExp_test.call(re, string);
39
34
  }
40
35
 
41
36
  function isWhitespace(string) {
42
- return !testRe(nonSpaceRe, string);
37
+ return !testRegExp(nonSpaceRe, string);
43
38
  }
44
39
 
45
- var isArray = Array.isArray || function (obj) {
46
- return Object.prototype.toString.call(obj) === "[object Array]";
40
+ var Object_toString = Object.prototype.toString;
41
+ var isArray = Array.isArray || function (object) {
42
+ return Object_toString.call(object) === '[object Array]';
47
43
  };
48
44
 
49
- function escapeRe(string) {
45
+ function isFunction(object) {
46
+ return typeof object === 'function';
47
+ }
48
+
49
+ function escapeRegExp(string) {
50
50
  return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
51
51
  }
52
52
 
@@ -65,10 +65,6 @@
65
65
  });
66
66
  }
67
67
 
68
- // Export the escaping function so that the user may override it.
69
- // See https://github.com/janl/mustache.js/issues/244
70
- exports.escape = escapeHtml;
71
-
72
68
  function Scanner(string) {
73
69
  this.string = string;
74
70
  this.tail = string;
@@ -90,9 +86,10 @@
90
86
  var match = this.tail.match(re);
91
87
 
92
88
  if (match && match.index === 0) {
93
- this.tail = this.tail.substring(match[0].length);
94
- this.pos += match[0].length;
95
- return match[0];
89
+ var string = match[0];
90
+ this.tail = this.tail.substring(string.length);
91
+ this.pos += string.length;
92
+ return string;
96
93
  }
97
94
 
98
95
  return "";
@@ -103,78 +100,68 @@
103
100
  * the skipped string, which is the entire tail if no match can be made.
104
101
  */
105
102
  Scanner.prototype.scanUntil = function (re) {
106
- var match, pos = this.tail.search(re);
103
+ var index = this.tail.search(re), match;
107
104
 
108
- switch (pos) {
105
+ switch (index) {
109
106
  case -1:
110
107
  match = this.tail;
111
- this.pos += this.tail.length;
112
108
  this.tail = "";
113
109
  break;
114
110
  case 0:
115
111
  match = "";
116
112
  break;
117
113
  default:
118
- match = this.tail.substring(0, pos);
119
- this.tail = this.tail.substring(pos);
120
- this.pos += pos;
114
+ match = this.tail.substring(0, index);
115
+ this.tail = this.tail.substring(index);
121
116
  }
122
117
 
118
+ this.pos += match.length;
119
+
123
120
  return match;
124
121
  };
125
122
 
126
123
  function Context(view, parent) {
127
- this.view = view;
124
+ this.view = view == null ? {} : view;
128
125
  this.parent = parent;
129
- this.clearCache();
126
+ this._cache = { '.': this.view };
130
127
  }
131
128
 
132
129
  Context.make = function (view) {
133
130
  return (view instanceof Context) ? view : new Context(view);
134
131
  };
135
132
 
136
- Context.prototype.clearCache = function () {
137
- this._cache = {};
138
- };
139
-
140
133
  Context.prototype.push = function (view) {
141
134
  return new Context(view, this);
142
135
  };
143
136
 
144
137
  Context.prototype.lookup = function (name) {
145
- var value = this._cache[name];
146
-
147
- if (!value) {
148
- if (name === ".") {
149
- value = this.view;
150
- } else {
151
- var context = this;
152
-
153
- while (context) {
154
- if (name.indexOf(".") > 0) {
155
- var names = name.split("."), i = 0;
138
+ var value;
139
+ if (name in this._cache) {
140
+ value = this._cache[name];
141
+ } else {
142
+ var context = this;
156
143
 
157
- value = context.view;
144
+ while (context) {
145
+ if (name.indexOf('.') > 0) {
146
+ value = context.view;
158
147
 
159
- while (value && i < names.length) {
160
- value = value[names[i++]];
161
- }
162
- } else {
163
- value = context.view[name];
148
+ var names = name.split('.'), i = 0;
149
+ while (value != null && i < names.length) {
150
+ value = value[names[i++]];
164
151
  }
152
+ } else {
153
+ value = context.view[name];
154
+ }
165
155
 
166
- if (value != null) {
167
- break;
168
- }
156
+ if (value != null) break;
169
157
 
170
- context = context.parent;
171
- }
158
+ context = context.parent;
172
159
  }
173
160
 
174
161
  this._cache[name] = value;
175
162
  }
176
163
 
177
- if (typeof value === "function") {
164
+ if (isFunction(value)) {
178
165
  value = value.call(this.view);
179
166
  }
180
167
 
@@ -194,7 +181,7 @@
194
181
  var fn = this._cache[template];
195
182
 
196
183
  if (!fn) {
197
- var tokens = exports.parse(template, tags);
184
+ var tokens = mustache.parse(template, tags);
198
185
  fn = this._cache[template] = this.compileTokens(tokens, template);
199
186
  }
200
187
 
@@ -207,13 +194,19 @@
207
194
  return fn;
208
195
  };
209
196
 
197
+ Writer.prototype.getPartial = function (name) {
198
+ if (!(name in this._partialCache) && this._loadPartial) {
199
+ this.compilePartial(name, this._loadPartial(name));
200
+ }
201
+
202
+ return this._partialCache[name];
203
+ };
204
+
210
205
  Writer.prototype.compileTokens = function (tokens, template) {
211
- var fn = compileTokens(tokens);
212
206
  var self = this;
213
-
214
207
  return function (view, partials) {
215
208
  if (partials) {
216
- if (typeof partials === "function") {
209
+ if (isFunction(partials)) {
217
210
  self._loadPartial = partials;
218
211
  } else {
219
212
  for (var name in partials) {
@@ -222,7 +215,7 @@
222
215
  }
223
216
  }
224
217
 
225
- return fn(self, Context.make(view), template);
218
+ return renderTokens(tokens, self, Context.make(view), template);
226
219
  };
227
220
  };
228
221
 
@@ -230,125 +223,76 @@
230
223
  return this.compile(template)(view, partials);
231
224
  };
232
225
 
233
- Writer.prototype._section = function (name, context, text, callback) {
234
- var value = context.lookup(name);
235
-
236
- switch (typeof value) {
237
- case "object":
238
- if (isArray(value)) {
239
- var buffer = "";
240
-
241
- for (var i = 0, len = value.length; i < len; ++i) {
242
- buffer += callback(this, context.push(value[i]));
243
- }
244
-
245
- return buffer;
246
- }
247
-
248
- return value ? callback(this, context.push(value)) : "";
249
- case "function":
250
- var self = this;
251
- var scopedRender = function (template) {
252
- return self.render(template, context);
253
- };
254
-
255
- var result = value.call(context.view, text, scopedRender);
256
- return result != null ? result : "";
257
- default:
258
- if (value) {
259
- return callback(this, context);
260
- }
261
- }
262
-
263
- return "";
264
- };
265
-
266
- Writer.prototype._inverted = function (name, context, callback) {
267
- var value = context.lookup(name);
268
-
269
- // Use JavaScript's definition of falsy. Include empty arrays.
270
- // See https://github.com/janl/mustache.js/issues/186
271
- if (!value || (isArray(value) && value.length === 0)) {
272
- return callback(this, context);
273
- }
274
-
275
- return "";
276
- };
226
+ /**
227
+ * Low-level function that renders the given `tokens` using the given `writer`
228
+ * and `context`. The `template` string is only needed for templates that use
229
+ * higher-order sections to extract the portion of the original template that
230
+ * was contained in that section.
231
+ */
232
+ function renderTokens(tokens, writer, context, template) {
233
+ var buffer = '';
277
234
 
278
- Writer.prototype._partial = function (name, context) {
279
- if (!(name in this._partialCache) && this._loadPartial) {
280
- this.compilePartial(name, this._loadPartial(name));
235
+ // This function is used to render an artbitrary template
236
+ // in the current context by higher-order functions.
237
+ function subRender(template) {
238
+ return writer.render(template, context);
281
239
  }
282
240
 
283
- var fn = this._partialCache[name];
284
-
285
- return fn ? fn(context) : "";
286
- };
241
+ var token, tokenValue, value;
242
+ for (var i = 0, len = tokens.length; i < len; ++i) {
243
+ token = tokens[i];
244
+ tokenValue = token[1];
287
245
 
288
- Writer.prototype._name = function (name, context) {
289
- var value = context.lookup(name);
246
+ switch (token[0]) {
247
+ case '#':
248
+ value = context.lookup(tokenValue);
290
249
 
291
- if (typeof value === "function") {
292
- value = value.call(context.view);
293
- }
250
+ if (typeof value === 'object' || typeof value === 'string') {
251
+ if (isArray(value)) {
252
+ for (var j = 0, jlen = value.length; j < jlen; ++j) {
253
+ buffer += renderTokens(token[4], writer, context.push(value[j]), template);
254
+ }
255
+ } else if (value) {
256
+ buffer += renderTokens(token[4], writer, context.push(value), template);
257
+ }
258
+ } else if (isFunction(value)) {
259
+ var text = template == null ? null : template.slice(token[3], token[5]);
260
+ value = value.call(context.view, text, subRender);
261
+ if (value != null) buffer += value;
262
+ } else if (value) {
263
+ buffer += renderTokens(token[4], writer, context, template);
264
+ }
294
265
 
295
- return (value == null) ? "" : String(value);
296
- };
266
+ break;
267
+ case '^':
268
+ value = context.lookup(tokenValue);
297
269
 
298
- Writer.prototype._escaped = function (name, context) {
299
- return exports.escape(this._name(name, context));
300
- };
270
+ // Use JavaScript's definition of falsy. Include empty arrays.
271
+ // See https://github.com/janl/mustache.js/issues/186
272
+ if (!value || (isArray(value) && value.length === 0)) {
273
+ buffer += renderTokens(token[4], writer, context, template);
274
+ }
301
275
 
302
- /**
303
- * Low-level function that compiles the given `tokens` into a function
304
- * that accepts three arguments: a Writer, a Context, and the template.
305
- */
306
- function compileTokens(tokens) {
307
- var subRenders = {};
308
-
309
- function subRender(i, tokens, template) {
310
- if (!subRenders[i]) {
311
- var fn = compileTokens(tokens);
312
- subRenders[i] = function (writer, context) {
313
- return fn(writer, context, template);
314
- };
276
+ break;
277
+ case '>':
278
+ value = writer.getPartial(tokenValue);
279
+ if (isFunction(value)) buffer += value(context);
280
+ break;
281
+ case '&':
282
+ value = context.lookup(tokenValue);
283
+ if (value != null) buffer += value;
284
+ break;
285
+ case 'name':
286
+ value = context.lookup(tokenValue);
287
+ if (value != null) buffer += mustache.escape(value);
288
+ break;
289
+ case 'text':
290
+ buffer += tokenValue;
291
+ break;
315
292
  }
316
-
317
- return subRenders[i];
318
293
  }
319
294
 
320
- return function (writer, context, template) {
321
- var buffer = "";
322
- var token, sectionText;
323
-
324
- for (var i = 0, len = tokens.length; i < len; ++i) {
325
- token = tokens[i];
326
-
327
- switch (token[0]) {
328
- case "#":
329
- sectionText = template.slice(token[3], token[5]);
330
- buffer += writer._section(token[1], context, sectionText, subRender(i, token[4], template));
331
- break;
332
- case "^":
333
- buffer += writer._inverted(token[1], context, subRender(i, token[4], template));
334
- break;
335
- case ">":
336
- buffer += writer._partial(token[1], context);
337
- break;
338
- case "&":
339
- buffer += writer._name(token[1], context);
340
- break;
341
- case "name":
342
- buffer += writer._escaped(token[1], context);
343
- break;
344
- case "text":
345
- buffer += token[1];
346
- break;
347
- }
348
- }
349
-
350
- return buffer;
351
- };
295
+ return buffer;
352
296
  }
353
297
 
354
298
  /**
@@ -395,12 +339,14 @@
395
339
  var token, lastToken;
396
340
  for (var i = 0, len = tokens.length; i < len; ++i) {
397
341
  token = tokens[i];
398
- if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
399
- lastToken[1] += token[1];
400
- lastToken[3] = token[3];
401
- } else {
402
- lastToken = token;
403
- squashedTokens.push(token);
342
+ if (token) {
343
+ if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
344
+ lastToken[1] += token[1];
345
+ lastToken[3] = token[3];
346
+ } else {
347
+ lastToken = token;
348
+ squashedTokens.push(token);
349
+ }
404
350
  }
405
351
  }
406
352
 
@@ -409,8 +355,8 @@
409
355
 
410
356
  function escapeTags(tags) {
411
357
  return [
412
- new RegExp(escapeRe(tags[0]) + "\\s*"),
413
- new RegExp("\\s*" + escapeRe(tags[1]))
358
+ new RegExp(escapeRegExp(tags[0]) + "\\s*"),
359
+ new RegExp("\\s*" + escapeRegExp(tags[1]))
414
360
  ];
415
361
  }
416
362
 
@@ -420,14 +366,12 @@
420
366
  * opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
421
367
  * course, the default is to use mustaches (i.e. Mustache.tags).
422
368
  */
423
- exports.parse = function (template, tags) {
369
+ function parseTemplate(template, tags) {
424
370
  template = template || '';
425
- tags = tags || exports.tags;
371
+ tags = tags || mustache.tags;
426
372
 
427
373
  if (typeof tags === 'string') tags = tags.split(spaceRe);
428
- if (tags.length !== 2) {
429
- throw new Error('Invalid tags: ' + tags.join(', '));
430
- }
374
+ if (tags.length !== 2) throw new Error('Invalid tags: ' + tags.join(', '));
431
375
 
432
376
  var tagRes = escapeTags(tags);
433
377
  var scanner = new Scanner(template);
@@ -443,7 +387,7 @@
443
387
  function stripSpace() {
444
388
  if (hasTag && !nonSpace) {
445
389
  while (spaces.length) {
446
- tokens.splice(spaces.pop(), 1);
390
+ delete tokens[spaces.pop()];
447
391
  }
448
392
  } else {
449
393
  spaces = [];
@@ -453,11 +397,12 @@
453
397
  nonSpace = false;
454
398
  }
455
399
 
456
- var start, type, value, chr;
400
+ var start, type, value, chr, token, openSection;
457
401
  while (!scanner.eos()) {
458
402
  start = scanner.pos;
459
- value = scanner.scanUntil(tagRes[0]);
460
403
 
404
+ // Match any text between tags.
405
+ value = scanner.scanUntil(tagRes[0]);
461
406
  if (value) {
462
407
  for (var i = 0, len = value.length; i < len; ++i) {
463
408
  chr = value.charAt(i);
@@ -468,143 +413,139 @@
468
413
  nonSpace = true;
469
414
  }
470
415
 
471
- tokens.push(["text", chr, start, start + 1]);
416
+ tokens.push(['text', chr, start, start + 1]);
472
417
  start += 1;
473
418
 
474
- if (chr === "\n") {
475
- stripSpace(); // Check for whitespace on the current line.
476
- }
419
+ // Check for whitespace on the current line.
420
+ if (chr == '\n') stripSpace();
477
421
  }
478
422
  }
479
423
 
480
- start = scanner.pos;
481
-
482
424
  // Match the opening tag.
483
- if (!scanner.scan(tagRes[0])) {
484
- break;
485
- }
486
-
425
+ if (!scanner.scan(tagRes[0])) break;
487
426
  hasTag = true;
488
- type = scanner.scan(tagRe) || "name";
489
427
 
490
- // Skip any whitespace between tag and value.
428
+ // Get the tag type.
429
+ type = scanner.scan(tagRe) || 'name';
491
430
  scanner.scan(whiteRe);
492
431
 
493
- // Extract the tag value.
494
- if (type === "=") {
432
+ // Get the tag value.
433
+ if (type === '=') {
495
434
  value = scanner.scanUntil(eqRe);
496
435
  scanner.scan(eqRe);
497
436
  scanner.scanUntil(tagRes[1]);
498
- } else if (type === "{") {
499
- var closeRe = new RegExp("\\s*" + escapeRe("}" + tags[1]));
500
- value = scanner.scanUntil(closeRe);
437
+ } else if (type === '{') {
438
+ value = scanner.scanUntil(new RegExp('\\s*' + escapeRegExp('}' + tags[1])));
501
439
  scanner.scan(curlyRe);
502
440
  scanner.scanUntil(tagRes[1]);
503
- type = "&";
441
+ type = '&';
504
442
  } else {
505
443
  value = scanner.scanUntil(tagRes[1]);
506
444
  }
507
445
 
508
446
  // Match the closing tag.
509
- if (!scanner.scan(tagRes[1])) {
510
- throw new Error('Unclosed tag at ' + scanner.pos);
511
- }
512
-
513
- // Check section nesting.
514
- if (type === '/') {
515
- if (sections.length === 0) {
516
- throw new Error('Unopened section "' + value + '" at ' + start);
517
- }
518
-
519
- var section = sections.pop();
520
-
521
- if (section[1] !== value) {
522
- throw new Error('Unclosed section "' + section[1] + '" at ' + start);
523
- }
524
- }
447
+ if (!scanner.scan(tagRes[1])) throw new Error('Unclosed tag at ' + scanner.pos);
525
448
 
526
- var token = [type, value, start, scanner.pos];
449
+ token = [type, value, start, scanner.pos];
527
450
  tokens.push(token);
528
451
 
529
452
  if (type === '#' || type === '^') {
530
453
  sections.push(token);
531
- } else if (type === "name" || type === "{" || type === "&") {
454
+ } else if (type === '/') {
455
+ // Check section nesting.
456
+ openSection = sections.pop();
457
+ if (!openSection) {
458
+ throw new Error('Unopened section "' + value + '" at ' + start);
459
+ }
460
+ if (openSection[1] !== value) {
461
+ throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
462
+ }
463
+ } else if (type === 'name' || type === '{' || type === '&') {
532
464
  nonSpace = true;
533
- } else if (type === "=") {
465
+ } else if (type === '=') {
534
466
  // Set the tags for the next time around.
535
467
  tags = value.split(spaceRe);
536
-
537
468
  if (tags.length !== 2) {
538
469
  throw new Error('Invalid tags at ' + start + ': ' + tags.join(', '));
539
470
  }
540
-
541
471
  tagRes = escapeTags(tags);
542
472
  }
543
473
  }
544
474
 
545
475
  // Make sure there are no open sections when we're done.
546
- var section = sections.pop();
547
- if (section) {
548
- throw new Error('Unclosed section "' + section[1] + '" at ' + scanner.pos);
476
+ openSection = sections.pop();
477
+ if (openSection) {
478
+ throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
549
479
  }
550
480
 
551
481
  return nestTokens(squashTokens(tokens));
552
- };
482
+ }
553
483
 
554
- // The high-level clearCache, compile, compilePartial, and render functions
555
- // use this default writer.
556
- var _writer = new Writer();
484
+ mustache.name = "mustache.js";
485
+ mustache.version = "0.7.3";
486
+ mustache.tags = ["{{", "}}"];
487
+
488
+ mustache.Scanner = Scanner;
489
+ mustache.Context = Context;
490
+ mustache.Writer = Writer;
491
+
492
+ mustache.parse = parseTemplate;
493
+
494
+ // Export the escaping function so that the user may override it.
495
+ // See https://github.com/janl/mustache.js/issues/244
496
+ mustache.escape = escapeHtml;
497
+
498
+ // All Mustache.* functions use this writer.
499
+ var defaultWriter = new Writer();
557
500
 
558
501
  /**
559
502
  * Clears all cached templates and partials in the default writer.
560
503
  */
561
- exports.clearCache = function () {
562
- return _writer.clearCache();
504
+ mustache.clearCache = function () {
505
+ return defaultWriter.clearCache();
563
506
  };
564
507
 
565
508
  /**
566
509
  * Compiles the given `template` to a reusable function using the default
567
510
  * writer.
568
511
  */
569
- exports.compile = function (template, tags) {
570
- return _writer.compile(template, tags);
512
+ mustache.compile = function (template, tags) {
513
+ return defaultWriter.compile(template, tags);
571
514
  };
572
515
 
573
516
  /**
574
517
  * Compiles the partial with the given `name` and `template` to a reusable
575
518
  * function using the default writer.
576
519
  */
577
- exports.compilePartial = function (name, template, tags) {
578
- return _writer.compilePartial(name, template, tags);
520
+ mustache.compilePartial = function (name, template, tags) {
521
+ return defaultWriter.compilePartial(name, template, tags);
579
522
  };
580
523
 
581
524
  /**
582
525
  * Compiles the given array of tokens (the output of a parse) to a reusable
583
526
  * function using the default writer.
584
527
  */
585
- exports.compileTokens = function (tokens, template) {
586
- return _writer.compileTokens(tokens, template);
528
+ mustache.compileTokens = function (tokens, template) {
529
+ return defaultWriter.compileTokens(tokens, template);
587
530
  };
588
531
 
589
532
  /**
590
533
  * Renders the `template` with the given `view` and `partials` using the
591
534
  * default writer.
592
535
  */
593
- exports.render = function (template, view, partials) {
594
- return _writer.render(template, view, partials);
536
+ mustache.render = function (template, view, partials) {
537
+ return defaultWriter.render(template, view, partials);
595
538
  };
596
539
 
597
540
  // This is here for backwards compatibility with 0.4.x.
598
- exports.to_html = function (template, view, partials, send) {
599
- var result = exports.render(template, view, partials);
541
+ mustache.to_html = function (template, view, partials, send) {
542
+ var result = mustache.render(template, view, partials);
600
543
 
601
- if (typeof send === "function") {
544
+ if (isFunction(send)) {
602
545
  send(result);
603
546
  } else {
604
547
  return result;
605
548
  }
606
549
  };
607
550
 
608
- return exports;
609
-
610
- }())));
551
+ }));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustachejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon COURTOIS