class NoBrainer::QueryRunner::EMDriver
Public Class Methods
sync(&block)
click to toggle source
# File lib/no_brainer/query_runner/em_driver.rb, line 15 def self.sync(&block) # Similar to em-synchrony's sync. f = Fiber.current block.call(proc do |val| if f == Fiber.current return val else f.resume(val) end end) Fiber.yield end
Public Instance Methods
call(env)
click to toggle source
# File lib/no_brainer/query_runner/em_driver.rb, line 5 def call(env) options = env[:options] options = options.merge(:db => RethinkDB::RQL.new.db(options[:db])) if options[:db] handler = ResponseHandler.new query_handler = env[:query].em_run(NoBrainer.connection.raw, handler, options) handler.on_dispatch(query_handler) handler.value end