# File lib/moqueue/mock_exchange.rb, line 8 def new(opts={}) if opts[:topic] && topic_exchange = MockBroker.instance.find_topic_exchange(opts[:topic]) return topic_exchange end if opts[:fanout] && fanout = MockBroker.instance.find_fanout_exchange(opts[:fanout]) return fanout end if opts[:direct] && direct = MockBroker.instance.find_direct_exchange(opts[:direct]) return direct end super end
# File lib/moqueue/mock_exchange.rb, line 26 def initialize(opts={}) if @topic = opts[:topic] MockBroker.instance.register_topic_exchange(self) elsif @fanout = opts[:fanout] MockBroker.instance.register_fanout_exchange(self) elsif @direct = opts[:direct] MockBroker.instance.register_direct_exchange(self) end end
# File lib/moqueue/mock_exchange.rb, line 40 def acked_messages attached_queues.map do |q| q = q.first if q.kind_of?(Array) q.acked_messages end.flatten end
# File lib/moqueue/mock_exchange.rb, line 47 def attach_queue(queue, opts={}) if topic attached_queues << [queue, TopicBindingKey.new(opts[:key])] elsif direct attached_queues << [queue, DirectBindingKey.new(opts[:key])] else attached_queues << queue end end
# File lib/moqueue/mock_exchange.rb, line 36 def attached_queues @attached_queues ||= [] end
Generated with the Darkfish Rdoc Generator 2.