Permalink
Browse files

Made everyModule.routes a getter (was a method).

  • Loading branch information...
1 parent 83d82cf commit 1cbf91b6076932d05ce8b1d365a6d4214fdbd0b4 @bnoguchi committed Apr 6, 2011
Showing with 18 additions and 17 deletions.
  1. +18 −17 lib/everymodule.js
View
@@ -43,23 +43,6 @@ var everyModule = module.exports = {
}
, get: route('get')
, post: route('post')
- , routes: function () {
- var arr = []
- , _routes = this._routes
- , _descriptions = this._configurable
- , aliases
- , self = this;
- for (var method in _routes) {
- aliases = _routes[method]
- method = method.toUpperCase();
- arr = arr.concat( aliases.map( function (alias) {
- return method + ' (' + alias + ') [' +
- self[alias]() + ']' +
- _descriptions[alias].replace(routeDescPrefix[method], '');
- }) );
- }
- return arr;
- }
, configurable: function (arg, description) {
if (!arguments.length)
return this._configurable;
@@ -208,6 +191,24 @@ var everyModule = module.exports = {
, _configurable: {}
};
+Object.defineProperty(everyModule, 'routes', {get: function () {
+ var arr = []
+ , _routes = this._routes
+ , _descriptions = this._configurable
+ , aliases
+ , self = this;
+ for (var method in _routes) {
+ aliases = _routes[method]
+ method = method.toUpperCase();
+ arr = arr.concat( aliases.map( function (alias) {
+ return method + ' (' + alias + ') [' +
+ self[alias]() + ']' +
+ _descriptions[alias].replace(routeDescPrefix[method], '');
+ }) );
+ }
+ return arr;
+}});
+
everyModule.configurable('init User');
everyModule

0 comments on commit 1cbf91b

Please sign in to comment.