Skip to content

Commit

Permalink
fix some warnings about uninitialized instance vars (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiomaster authored and arempe93 committed Oct 23, 2017
1 parent de26db2 commit 468fe86
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/bunny_mock/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,7 +84,6 @@ def publish(payload, opts = {})
# @api public
#
def subscribe(*args, &block)
@consumers ||= []
@consumers << [block, args]
yield_consumers

Expand All @@ -94,7 +99,6 @@ def subscribe(*args, &block)
# @api public
#
def subscribe_with(consumer, *args)
@consumers ||= []
@consumers << [consumer, args]
yield_consumers

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 468fe86

Please sign in to comment.