From 468fe867815bd86fde9797379964b7336d5bcfec Mon Sep 17 00:00:00 2001 From: Christoph Wagner Date: Mon, 23 Oct 2017 15:54:05 +0200 Subject: [PATCH] fix some warnings about uninitialized instance vars (#35) --- lib/bunny_mock/queue.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/bunny_mock/queue.rb b/lib/bunny_mock/queue.rb index 9da2c6a..db98f1c 100644 --- a/lib/bunny_mock/queue.rb +++ b/lib/bunny_mock/queue.rb @@ -31,6 +31,12 @@ def initialize(channel, name = '', opts = {}) # Store messages @messages = [] + + # Store consumers subsribed to that queue + @consumers = [] + + # marks if this queue is deleted + @deleted = false end # @group Bunny API @@ -78,7 +84,6 @@ def publish(payload, opts = {}) # @api public # def subscribe(*args, &block) - @consumers ||= [] @consumers << [block, args] yield_consumers @@ -94,7 +99,6 @@ def subscribe(*args, &block) # @api public # def subscribe_with(consumer, *args) - @consumers ||= [] @consumers << [consumer, args] yield_consumers @@ -257,7 +261,6 @@ def pop_response(message) # @private def yield_consumers - return if @consumers.nil? @consumers.each do |c, args| # rubocop:disable AssignmentInCondition while message = all.pop