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

Defined in:
lib/mysql2/em.rb

Instance Method Summary (collapse)

Instance Method Details

- (Watcher) initialize(client, deferable)

A new instance of Watcher

Returns:

  • (Watcher)

    a new instance of Watcher



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

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

- (Object) notify_readable



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

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