Class: Bridge::Bridge::SystemService

Inherits:
Object
  • Object
show all
Defined in:
lib/bridge.rb

Overview

These are internal system functions, which should only be called by the Erlang gateway.

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ SystemService

:nodoc:



278
279
280
# File 'lib/bridge.rb', line 278

def initialize bridge
  @bridge = bridge
end

Instance Method Details

#getService(name, callback) ⇒ Object



291
292
293
294
295
296
297
# File 'lib/bridge.rb', line 291

def getService name, callback
  if @bridge.store.key? name
    callback.call(@bridge.store[name], name)
  else
    callback.call(nil, name)
  end
end

#hookChannelHandler(name, handler, callback = nil) ⇒ Object



282
283
284
285
286
287
288
289
# File 'lib/bridge.rb', line 282

def hookChannelHandler name, handler, callback = nil
  # Retrieve requested handler
  obj = @bridge.store[handler.address[2]]
  # Store under channel name
  @bridge.store["channel:#{name}"] = obj
  # Send callback with reference to channel and handler operations
  callback.call(Reference.new(self, ['channel', name, "channel:#{name}"], Util.find_ops(obj)), name) if callback
end

#remoteError(msg) ⇒ Object



299
300
301
302
# File 'lib/bridge.rb', line 299

def remoteError msg
  Util.warn msg
  @bridge.emit 'remote_error', [msg]
end