Sha256: 1fd3f53a75ecd2d1e20617c943a9ac3df8bd0f9492dcc1408b860a8aba087950
Contents?: true
Size: 635 Bytes
Versions: 1
Compression:
Stored size: 635 Bytes
Contents
class NetworkInterfaceAPI def initialize(node) @node=node @receivers={} if @node @node.addReceiver(self) {|from,args| receive(from,args) } end end def me @node.me end def addReceiver(api,&block) @receivers[api]=block end def removeReceiver(app) @receivers.delete(app) end def log(*x) @node.log(*x) end # close the api-object - api won't listen anymore def close @node.removeReceiver(self) end def receive(from,args) @receivers.each{|k,v|v.call(from,args)} end def sendMessage(data,node) @node.sendMessage(data,node) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appswarm-0.0.1 | apps/udp_network/network_interface_api.rb |