Class: RethinkDB::EMHandler

Inherits:
AsyncHandler show all
Defined in:
lib/nobrainer_streams/rethinkdb_monkeypatch.rb

Overview

AsyncHandler that uses EventMachine to dispatch events

Instance Attribute Summary

Attributes inherited from AsyncHandler

#callback, #connection, #options

Instance Method Summary collapse

Instance Method Details

#handlerObject



36
37
38
# File 'lib/nobrainer_streams/rethinkdb_monkeypatch.rb', line 36

def handler
  callback
end

#runObject



26
27
28
29
30
31
32
33
34
# File 'lib/nobrainer_streams/rethinkdb_monkeypatch.rb', line 26

def run
  if !EM.reactor_running?
    raise RuntimeError, "RethinkDB::RQL::em_run can only be called inside `EM.run`"
  end

  EM_Guard.register(connection)
  options[:query_handle_class] = EMQueryHandle
  yield
end