Sha256: 78beb5bd4a5d39f7c8f84afdbb5805a7f42384643e1bee6bbebecd62e9be8a7c
Contents?: true
Size: 496 Bytes
Versions: 2
Compression:
Stored size: 496 Bytes
Contents
module EMJack module Handler class Ok RESPONSE = /^OK\s+(\d+)\r\n/ def self.handles?(response) if response =~ RESPONSE [true, $1.to_i] else false end end def self.handle(deferrable, response, body) return false unless response =~ RESPONSE bytes = $1.to_i deferrable.succeed(YAML.load(body)) true end EMJack::Connection.register_handler(EMJack::Handler::Ok) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
em-jack-0.0.6 | lib/em-jack/handlers/ok.rb |
em-jack-0.0.5 | lib/em-jack/handlers/ok.rb |