Sha256: 7d8e9805b0096f1519a4138b22da0905ff7a009700a8a4aa0fe27de97fff24be

Contents?: true

Size: 418 Bytes

Versions: 2

Compression:

Stored size: 418 Bytes

Contents

module EMJack
  module Handler
    class Inserted
      RESPONSE = /^INSERTED\s+(\d+)\r\n/

      def self.handles?(response)
        response =~ RESPONSE
      end

      def self.handle(deferrable, response, body)
        return false unless response =~ RESPONSE

        deferrable.succeed($1.to_i)
        true
      end
      
      EMJack::Connection.register_handler(EMJack::Handler::Inserted)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-jack-0.0.6 lib/em-jack/handlers/inserted.rb
em-jack-0.0.5 lib/em-jack/handlers/inserted.rb