Method: Hopper::Channel#queue

Defined in:
lib/hopper/channel.rb

#queue(name) ⇒ Object

[View source]

29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hopper/channel.rb', line 29

def queue(name)
  if @queues.has_key?(name)
    @queues[name] 
  else
    #TODO: This violates SRP. We both manage caching the queues and
    #constructing a bunch of intermediate objects. I'm wondering if this
    #belongs more in a factory somewhere else.
    queue = Hopper::Queue.new(name)
    proxy = Hopper::Channel::Proxy.new(self, @bunny)
    @queues[name] = Hopper::Channel::Queue.new(proxy, queue)
  end
end