Class: EMJack::Handler::Ok
- Inherits:
-
Object
- Object
- EMJack::Handler::Ok
- Defined in:
- lib/em-jack/handlers/ok.rb
Constant Summary collapse
- RESPONSE =
/^OK\s+(\d+)\r\n/
Class Method Summary collapse
Class Method Details
.handle(deferrable, response, body, conn = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/em-jack/handlers/ok.rb', line 14 def self.handle(deferrable, response, body, conn=nil) return false unless response =~ RESPONSE bytes = $1.to_i deferrable.succeed(YAML.load(body)) true end |
.handles?(response) ⇒ Boolean
6 7 8 9 10 11 12 |
# File 'lib/em-jack/handlers/ok.rb', line 6 def self.handles?(response) if response =~ RESPONSE [true, $1.to_i] else false end end |