Class: Liebre::Actor::Context::Declare
- Inherits:
-
Object
- Object
- Liebre::Actor::Context::Declare
- Defined in:
- lib/liebre/actor/context/declare.rb
Instance Method Summary collapse
- #bind(queue, exchange, config = {}) ⇒ Object
- #default_exchange ⇒ Object
- #exchange(config) ⇒ Object
-
#initialize(chan) ⇒ Declare
constructor
A new instance of Declare.
- #queue(config) ⇒ Object
Constructor Details
#initialize(chan) ⇒ Declare
Returns a new instance of Declare.
6 7 8 |
# File 'lib/liebre/actor/context/declare.rb', line 6 def initialize chan @chan = chan end |
Instance Method Details
#bind(queue, exchange, config = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/liebre/actor/context/declare.rb', line 29 def bind queue, exchange, config = {} all_opts = [config].flatten all_opts.each do |opts| queue.bind(exchange, opts) end end |
#default_exchange ⇒ Object
10 11 12 |
# File 'lib/liebre/actor/context/declare.rb', line 10 def default_exchange chan.default_exchange end |
#exchange(config) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/liebre/actor/context/declare.rb', line 14 def exchange config name = config.fetch(:name) type = config.fetch(:type) opts = config.fetch(:opts, {}) chan.exchange(name, type, opts) end |
#queue(config) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/liebre/actor/context/declare.rb', line 22 def queue config name = config.fetch(:name) opts = config.fetch(:opts, {}) chan.queue(name, opts) end |