Sha256: 7decebf7aed9a79be4bca26f6c42b84fb6869c23da7f50fb0b3379378899e39e

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

module EM
  class Beanstalk
    class Connection < EM::Connection
      attr_accessor :client
  
      def connection_completed
        client.connected
      end

      def receive_data(data)
        client.received(data)
      end
  
      def send(command, *args)
        real_send(command, args, nil)
      end
  
      def send_with_data(command, data, *args)
        real_send(command, args, data)
      end
  
      def unbind
        client.disconnected
      end
      
      protected
      def real_send(command, args, data = nil)
        send_data(command.to_s)
        args.each{ |a| send_data(' '); send_data(a) }
        send_data("\r\n")
        if data
          send_data(data)
          send_data("\r\n")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-beanstalk-0.0.5 lib/em-beanstalk/connection.rb
em-beanstalk-0.0.4 lib/em-beanstalk/connection.rb