2011-11-20 21:21:09 +00:00
|
|
|
/*
|
|
|
|
* literal.js: Simple literal Object store for nconf.
|
|
|
|
*
|
2011-11-24 05:33:08 +00:00
|
|
|
* (C) 2011, Nodejitsu Inc.
|
2011-11-20 21:21:09 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-04-14 19:28:55 +00:00
|
|
|
var util = require('util'),
|
2011-11-20 21:21:09 +00:00
|
|
|
Memory = require('./memory').Memory
|
|
|
|
|
2011-11-23 21:41:07 +00:00
|
|
|
var Literal = exports.Literal = function Literal (options) {
|
|
|
|
Memory.call(this, options);
|
2012-04-14 19:28:55 +00:00
|
|
|
|
2011-11-23 21:41:07 +00:00
|
|
|
options = options || {}
|
2011-11-21 01:00:04 +00:00
|
|
|
this.type = 'literal';
|
|
|
|
this.readOnly = true;
|
2011-11-24 05:14:52 +00:00
|
|
|
this.store = options.store || options;
|
2011-11-20 21:21:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Inherit from Memory store.
|
2011-11-23 21:41:07 +00:00
|
|
|
util.inherits(Literal, Memory);
|
|
|
|
|
|
|
|
//
|
|
|
|
// ### function loadSync (callback)
|
|
|
|
// Returns the data stored in `this.store` synchronously.
|
|
|
|
//
|
|
|
|
Literal.prototype.loadSync = function () {
|
|
|
|
return this.store;
|
|
|
|
};
|