Navigation Menu

Skip to content

Commit

Permalink
Add "reopen()" for wrapped nroonga
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 6, 2012
1 parent e507546 commit cae1eb2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/wrapped-nroonga.js
Expand Up @@ -33,6 +33,7 @@ var TokenBigram =
function Context(source) {
if (typeof source == 'string') { // path
mkdirp.sync(path.dirname(source));
this._path = source;
this._context = new nroonga.Database(source);
} else if (source instanceof nroonga.Database)
this._context = source;
Expand Down Expand Up @@ -95,6 +96,13 @@ Context.prototype = {
return column.name.charAt(0) !== '_';
});
return ordinalColumns;
},

reopen: function() {
if (!this._path)
throw new Error('cannot reopen');
this._context = new nroonga.Database(this._path);
return this;
}
};

Expand Down

0 comments on commit cae1eb2

Please sign in to comment.