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

Defined in:
lib/mysql2/em.rb

Instance Method Summary collapse

Instance Method Details

#initialize(client, deferable) ⇒ Object



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

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

#notify_readableObject



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

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

#unbindObject



29
30
31
# File 'lib/mysql2/em.rb', line 29

def unbind
  @is_watching = false
end

#watching?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/mysql2/em.rb', line 25

def watching?
  @is_watching
end