Pass connection when requiring adaptors

This commit is contained in:
Andrew Stewart 2013-10-23 15:32:20 -07:00
parent 2c34f4c77e
commit 2c6d7ea7c3
1 changed files with 2 additions and 2 deletions

View File

@ -72,10 +72,10 @@ module.exports = class Robot
@requireAdaptor = (adaptorName, connection) =>
if @adaptors[adaptorName]?
if typeof @adaptors[adaptorName] is 'string'
@adaptors[adaptorName] = require(@adaptors[adaptorName]).adaptor(name: adaptorName)
@adaptors[adaptorName] = require(@adaptors[adaptorName]).adaptor(name: adaptorName, connection: connection)
else
require("cylon-#{adaptorName}").register(this)
@adaptors[adaptorName] = require("cylon-#{adaptorName}").adaptor(name: adaptorName)
@adaptors[adaptorName] = require("cylon-#{adaptorName}").adaptor(name: adaptorName, connection: connection)
return @adaptors[adaptorName]