Class: EMJack::Handler::Buried
- Inherits:
-
Object
- Object
- EMJack::Handler::Buried
- Defined in:
- lib/em-jack/handlers/buried.rb
Constant Summary collapse
- RESPONSE =
/^BURIED(\s+(\d+))?\r\n/
Class Method Summary collapse
Class Method Details
.handle(deferrable, response, body, conn = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/em-jack/handlers/buried.rb', line 10 def self.handle(deferrable, response, body, conn=nil) return false unless response =~ RESPONSE # if there is an id this is the response of a put command # otherwise, it's either the result of a BURY command or # a release command. I'm assuming the latter 2 are success # and the first is a failure id = $2 if id.nil? deferrable.succeed else deferrable.fail(:buried, id.to_i) end true end |
.handles?(response) ⇒ Boolean
6 7 8 |
# File 'lib/em-jack/handlers/buried.rb', line 6 def self.handles?(response) response =~ RESPONSE end |