class EmmyExtends::Mysql2::Operation

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/emmy_extends/mysql2/operation.rb, line 8
def initialize(client)
  @client = client
end

Public Instance Methods

sync() click to toggle source
# File lib/emmy_extends/mysql2/operation.rb, line 16
def sync
  Fiber.sync do |fiber|
    watch

    on :success do |response, operation, conn|
      fiber.resume response
    end

    on :error do |error, operation, conn|
      fiber.leave error
    end
  end
end
to_a() click to toggle source
# File lib/emmy_extends/mysql2/operation.rb, line 30
def to_a
  [client.socket, Mysql2::Watcher, @client, self, {notify_readable: true, notify_writable: false}]
end
watch() click to toggle source
# File lib/emmy_extends/mysql2/operation.rb, line 12
def watch
  @watch ||= EmmyMachine.watch(*self)
end