Browse files

Make constructor expect hash

  • Loading branch information...
1 parent 734e928 commit fc0ae16c80caf02a67110279d7df4d691418cb15 @felixge committed Nov 15, 2011
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/carbon_client.js
  2. +1 −1 test/unit/test-client.js
View
6 lib/carbon_client.js
@@ -2,8 +2,8 @@ var net = require('net');
var url = require('url');
module.exports = CarbonClient;
-function CarbonClient(socket) {
- this.socket = socket;
+function CarbonClient(options) {
+ this.socket = options.socket;
this.host = null;
this.port = null;
}
@@ -30,7 +30,7 @@ CarbonClient.createClient = function(dsn) {
var parsed = this.parse(dsn);
var socket = net.createConnection(parsed.port, parsed.host);
- var client = new this(socket);
+ var client = new this({socket: socket});
client.host = parsed.host;
client.port = parsed.port;
View
2 test/unit/test-client.js
@@ -14,7 +14,7 @@ SocketDummy.prototype.write = function() {
var client;
test('write', {
before: function() {
- client = new CarbonClient(new SocketDummy());
+ client = new CarbonClient({socket: new SocketDummy()});
},
'with single payload': function() {

0 comments on commit fc0ae16

Please sign in to comment.