Module: Mysql2::EM::Client::Watcher

Defined in:
lib/mysql2/em.rb

Instance Method Summary collapse

Instance Method Details

#initialize(client, deferable) ⇒ Object



10
11
12
13
# File 'lib/mysql2/em.rb', line 10

def initialize(client, deferable)
  @client = client
  @deferable = deferable
end

#notify_readableObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/mysql2/em.rb', line 15

def notify_readable
  detach
  begin
    result = @client.async_result
  rescue Exception => e
    @deferable.fail(e)
  else
    @deferable.succeed(result)
  end
end