Class: BunnyExchanges::Manager
- Inherits:
-
Object
- Object
- BunnyExchanges::Manager
- Defined in:
- lib/bunny_exchanges/manager.rb
Overview
Class keeps all configured exchanges through the same connection and channel.
Instance Method Summary collapse
-
#get(action) ⇒ Bunny::Exchange
Gets or builds the required exchange.
-
#initialize(config = BunnyExchanges.configuration) ⇒ Manager
constructor
Constructor.
Constructor Details
#initialize(config = BunnyExchanges.configuration) ⇒ Manager
Constructor.
12 13 14 15 |
# File 'lib/bunny_exchanges/manager.rb', line 12 def initialize config = BunnyExchanges.configuration @config = config @exchanges = {} end |
Instance Method Details
#get(action) ⇒ Bunny::Exchange
Gets or builds the required exchange.
22 23 24 25 26 27 28 |
# File 'lib/bunny_exchanges/manager.rb', line 22 def get action exchanges[action.to_sym] ||= begin name, = params_for(action) channel.exchange(name, ) end end |