Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
runat-1128988: Add system.toString for debugging purposes.
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Walker <[email protected]>
  • Loading branch information
joewalker committed Feb 6, 2015
1 parent 75c9db4 commit 3975380
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/gcli/converters/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ Converters.prototype.get = function(from, to) {
return converter;
};

/**
* Get all the registered converters. Most for debugging
*/
Converters.prototype.getAll = function() {
return Object.keys(this._registered.from).map(function(name) {
return this._registered.from[name];
}.bind(this));
};

/**
* Helper for get to pick the best fallback converter
*/
Expand Down
7 changes: 7 additions & 0 deletions lib/gcli/fields/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ Fields.prototype.get = function(type, options) {
return new FieldConstructor(type, options);
};

/**
* Get all the registered fields. Most for debugging
*/
Fields.prototype.getAll = function() {
return this._fieldCtors.slice();
};

exports.Fields = Fields;

/**
Expand Down
10 changes: 10 additions & 0 deletions lib/gcli/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ exports.createSystem = function(options) {
pendingChanges = false;

return Promise.all(promises);
},

toString: function() {
return 'System [' +
'commands:' + components.command.getAll().length + ', ' +
'connectors:' + components.connector.getAll().length + ', ' +
'converters:' + components.converter.getAll().length + ', ' +
'fields:' + components.field.getAll().length + ', ' +
'settings:' + components.setting.getAll().length + ', ' +
'types:' + components.type.getTypeNames().length + ']';
}
};

Expand Down

1 comment on commit 3975380

@bgrins
Copy link

@bgrins bgrins commented on 3975380 Feb 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.