Class: Freddy::Adapters::BunnyAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/freddy/adapters/bunny_adapter.rb

Defined Under Namespace

Classes: Channel, Queue

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bunny) ⇒ BunnyAdapter

Returns a new instance of BunnyAdapter.



12
13
14
# File 'lib/freddy/adapters/bunny_adapter.rb', line 12

def initialize(bunny)
  @bunny = bunny
end

Class Method Details

.connect(config) ⇒ Object



6
7
8
9
10
# File 'lib/freddy/adapters/bunny_adapter.rb', line 6

def self.connect(config)
  bunny = Bunny.new(config)
  bunny.start
  new(bunny)
end

Instance Method Details

#closeObject



22
23
24
# File 'lib/freddy/adapters/bunny_adapter.rb', line 22

def close
  @bunny.close
end

#create_channel(prefetch: nil) ⇒ Object



16
17
18
19
20
# File 'lib/freddy/adapters/bunny_adapter.rb', line 16

def create_channel(prefetch: nil)
  bunny_channel = @bunny.create_channel
  bunny_channel.prefetch(prefetch) if prefetch
  Channel.new(bunny_channel)
end