Class: Moped::TimeoutHandler
- Inherits:
-
Object
- Object
- Moped::TimeoutHandler
- Defined in:
- lib/webmate/support/em_mongoid.rb
Class Method Summary collapse
Class Method Details
.timeout(op_timeout, &block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/webmate/support/em_mongoid.rb', line 11 def self.timeout(op_timeout, &block) f = Fiber.current timer = EM::Timer.new(op_timeout) { f.resume(nil) } res = block.call timer.cancel res end |