Class: EmmyExtends::Mysql2::Operation
- Inherits:
-
Object
- Object
- EmmyExtends::Mysql2::Operation
- Defined in:
- lib/emmy_extends/mysql2/operation.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Operation
constructor
A new instance of Operation.
- #sync ⇒ Object
- #to_a ⇒ Object
- #watch ⇒ Object
Constructor Details
#initialize(client) ⇒ Operation
Returns a new instance of Operation.
8 9 10 |
# File 'lib/emmy_extends/mysql2/operation.rb', line 8 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/emmy_extends/mysql2/operation.rb', line 6 def client @client end |
Instance Method Details
#sync ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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 ⇒ Object
30 31 32 |
# 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 ⇒ Object
12 13 14 |
# File 'lib/emmy_extends/mysql2/operation.rb', line 12 def watch @watch ||= EmmyMachine.watch(*self) end |