lib/amqp/exchange.rb in famoseagle-carrot-0.5.0 vs lib/amqp/exchange.rb in famoseagle-carrot-0.6.0

- old
+ new

@@ -1,12 +1,13 @@ module Carrot::AMQP class Exchange - attr_accessor :server, :type, :name, :opts, :key + attr_reader :server, :type, :name, :opts, :key, :carrot - def initialize(server, type, name, opts = {}) - @server, @type, @name, @opts = server, type, name, opts + def initialize(carrot, type, name, opts = {}) + @server, @type, @name, @opts = carrot.server, type, name, opts @key = opts[:key] + @carrot = carrot unless name == "amq.#{type}" or name == '' server.send_frame( Protocol::Exchange::Declare.new( { :exchange => name, :type => type, :nowait => true }.merge(opts) @@ -38,9 +39,10 @@ def delete(opts = {}) server.send_frame( Protocol::Exchange::Delete.new({ :exchange => name, :nowait => true }.merge(opts)) ) + carrot.exchanges.delete(name) end def reset initialize(server, type, name, opts) end