Class: Object

Inherits:
BasicObject
Defined in:
lib/empathy/object.rb

Overview

Monkey patch object to make EM safe

Instance Method Summary collapse

Instance Method Details

#at_exit(&block) ⇒ Object

use Empathy::EM::Kernel.at_exit if we are in the reactor, Kernel.sleep otherwise



14
15
16
17
# File 'lib/empathy/object.rb', line 14

def at_exit(&block)
  kernel = Empathy.event_machine? ? Empathy::EM::Kernel : Kernel
  kernel.at_exit(&block)
end

#sleep(*args) ⇒ Object

use Empathy::EM::Kernel.sleep if we are in the reactor, Kernel.sleep otherwise



8
9
10
11
# File 'lib/empathy/object.rb', line 8

def sleep(*args)
  kernel = Empathy.event_machine? ? Empathy::EM::Kernel : Kernel
  kernel.sleep(*args)
end