lib/amqp/client.rb in celldee-bunny-0.0.5 vs lib/amqp/client.rb in celldee-bunny-0.0.6

- old
+ new

@@ -4,22 +4,19 @@ RETRY_DELAY = 10.0 attr_reader :status attr_accessor :channel, :host, :logging, :exchanges, :queues, :port, :ticket - class ServerDown < StandardError; end - class ProtocolError < StandardError; end - def initialize(opts = {}) @host = opts[:host] || 'localhost' @port = opts[:port] || AMQP::PORT @user = opts[:user] || 'guest' @pass = opts[:pass] || 'guest' @vhost = opts[:vhost] || '/' @logging = opts[:logging] || false @insist = opts[:insist] - @status = 'NOT CONNECTED' + @status = NOT_CONNECTED end def exchanges @exchanges ||= {} end @@ -146,11 +143,11 @@ end if Socket.constants.include? 'TCP_NODELAY' @socket.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1 end - @status = 'CONNECTED' + @status = CONNECTED rescue SocketError, SystemCallError, IOError, Timeout::Error => e raise ServerDown, e.message end @socket @@ -158,17 +155,17 @@ def close_socket(reason=nil) # Close the socket. The server is not considered dead. @socket.close if @socket and not @socket.closed? @socket = nil - @status = "NOT CONNECTED" + @status = NOT_CONNECTED end def log(*args) return unless logging require 'pp' pp args - puts + puts end end end \ No newline at end of file