Sha256: c56aeadb54a39b7d7f7dca011db5339c832ead2abd0cf8b0c889b270057d59fb

Contents?: true

Size: 580 Bytes

Versions: 6

Compression:

Stored size: 580 Bytes

Contents

require 'eventmachine'

module EMJack
  class BeanstalkConnection < EM::Connection
    attr_accessor :client

    def connection_completed
      @client.connected
    end

    def receive_data(data)
      @client.received(data)
    end

    def send(command, *args)
      cmd = command.to_s
      cmd << " #{args.join(" ")}" unless args.length == 0
      cmd << "\r\n"
      send_data(cmd)
    end

    def send_with_data(command, data, *args)
      send_data("#{command.to_s} #{args.join(" ")}\r\n#{data}\r\n")
    end

    def unbind
      @client.disconnected
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
em-jack-0.1.5 lib/em-jack/beanstalk_connection.rb
em-jack-0.1.4 lib/em-jack/beanstalk_connection.rb
em-jack-0.1.3 lib/em-jack/beanstalk_connection.rb
em-jack-0.1.2 lib/em-jack/beanstalk_connection.rb
em-jack-0.1.1 lib/em-jack/beanstalk_connection.rb
em-jack-0.1.0 lib/em-jack/beanstalk_connection.rb