Class: ProxyLocal::ClientProxy

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/proxylocal/client_proxy.rb

Instance Method Summary collapse

Instance Method Details

#on_data(&block) ⇒ Object



17
18
19
# File 'lib/proxylocal/client_proxy.rb', line 17

def on_data(&block)
  @callbacks[:on_data] = block
end

#on_unbind(&block) ⇒ Object



21
22
23
# File 'lib/proxylocal/client_proxy.rb', line 21

def on_unbind(&block)
  @callbacks[:on_unbind] = block
end

#post_initObject



5
6
7
# File 'lib/proxylocal/client_proxy.rb', line 5

def post_init
  @callbacks = {}
end

#receive_data(data) ⇒ Object



9
10
11
# File 'lib/proxylocal/client_proxy.rb', line 9

def receive_data(data)
  @callbacks[:on_data].call(data) if @callbacks.has_key?(:on_data)
end

#unbindObject



13
14
15
# File 'lib/proxylocal/client_proxy.rb', line 13

def unbind
  @callbacks[:on_unbind].call if @callbacks.has_key?(:on_unbind)
end