Module: EmmyExtends::Mysql2::Watcher

Defined in:
lib/emmy_extends/mysql2/watcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/emmy_extends/mysql2/watcher.rb', line 4

def client
  @client
end

#operationObject

Returns the value of attribute operation.



4
5
6
# File 'lib/emmy_extends/mysql2/watcher.rb', line 4

def operation
  @operation
end

Instance Method Details

#initialize(client, operation) ⇒ Object



6
7
8
9
# File 'lib/emmy_extends/mysql2/watcher.rb', line 6

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

#notify_readableObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/emmy_extends/mysql2/watcher.rb', line 11

def notify_readable
  detach
  begin
    result = @client.async_result
  rescue Exception => e
    @operation.error!(e.to_s, @operation, self)
  else
    @operation.success!(result, @operation, self)
  end
end