Module: Otaku::Client::EM

Defined in:
lib/otaku/client.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#execute(method, &callback) ⇒ Object



26
27
28
29
# File 'lib/otaku/client.rb', line 26

def execute(method, &callback)
  @callback = callback
  send_data(method)
end

#receive_data(data) ⇒ Object



20
21
22
23
24
# File 'lib/otaku/client.rb', line 20

def receive_data(data)
  result = @callback.call(data)
  result.is_a?(DataProcessError) ? raise(result) : result
  EventMachine::stop_event_loop # ends loop & resumes program flow
end