Class: Swift::Adapter::Eventmachine::Handler
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Swift::Adapter::Eventmachine::Handler
- Defined in:
- lib/swift/adapter/eventmachine.rb
Instance Method Summary collapse
-
#initialize(adapter, record, defer) ⇒ Handler
constructor
A new instance of Handler.
- #notify_readable ⇒ Object
Constructor Details
#initialize(adapter, record, defer) ⇒ Handler
Returns a new instance of Handler.
11 12 13 14 15 16 |
# File 'lib/swift/adapter/eventmachine.rb', line 11 def initialize adapter, record, defer @started = Time.now @adapter = adapter @record = record @defer = defer end |
Instance Method Details
#notify_readable ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/swift/adapter/eventmachine.rb', line 18 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 |