Module: Jack::Queues::Mock

Defined in:
lib/jack/queues/mock.rb

Instance Method Summary collapse

Instance Method Details

#connectionObject



4
5
6
# File 'lib/jack/queues/mock.rb', line 4

def connection
  @connection ||= []
end

#create(name_or_data, data = nil) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/jack/queues/mock.rb', line 16

def create(name_or_data, data = nil)
  if data.nil?
    data         = name_or_data
    name_or_data = @queue_name
  end
  created << [name_or_data, data]
end

#createdObject



24
25
26
# File 'lib/jack/queues/mock.rb', line 24

def created
  @created ||= []
end

#delete(message) ⇒ Object



12
13
14
# File 'lib/jack/queues/mock.rb', line 12

def delete(message)
  messages.delete message
end

#messagesObject



8
9
10
# File 'lib/jack/queues/mock.rb', line 8

def messages
  @messages ||= (connection.shift || [])
end