Class: Swift::Adapter::EMHandler
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Swift::Adapter::EMHandler
- Defined in:
- lib/swift/eventmachine.rb
Instance Method Summary collapse
-
#initialize(adapter, record, defer) ⇒ EMHandler
constructor
A new instance of EMHandler.
- #notify_readable ⇒ Object
Constructor Details
#initialize(adapter, record, defer) ⇒ EMHandler
Returns a new instance of EMHandler.
12 13 14 15 16 17 |
# File 'lib/swift/eventmachine.rb', line 12 def initialize adapter, record, defer @started = Time.now @adapter = adapter @record = record @defer = defer end |
Instance Method Details
#notify_readable ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/swift/eventmachine.rb', line 19 def notify_readable detach start, command, bind = @adapter.pending.shift @adapter.log_command(start, command, bind) if @adapter.trace? begin @defer.succeed(@record ? Result.new(@record, @adapter.result) : @adapter.result) rescue Exception => e @defer.fail(e) end end |