123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Defined in: lib/mysql2/em.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#watching?Boolean (readonly)

[ GitHub ]

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

def watching?
  @is_watching
end

Instance Method Details

#initialize(client, deferable)

[ GitHub ]

  
# File 'lib/mysql2/em.rb', line 8

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

#notify_readable

[ GitHub ]

  
# 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

#unbind

[ GitHub ]

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

def unbind
  @is_watching = false
end