Module: Mysql2::EM::Client::Watcher
- Defined in:
- lib/mysql2/em.rb
Instance Method Summary collapse
- #initialize(client, deferable) ⇒ Object
- #notify_readable ⇒ Object
- #unbind ⇒ Object
- #watching? ⇒ Boolean
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_readable ⇒ Object
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 |
#unbind ⇒ Object
29 30 31 |
# File 'lib/mysql2/em.rb', line 29 def unbind @is_watching = false end |
#watching? ⇒ Boolean
25 26 27 |
# File 'lib/mysql2/em.rb', line 25 def watching? @is_watching end |