Module: Liebre::Common::Utils
- Defined in:
- lib/liebre/common/utils.rb
Class Method Summary collapse
Class Method Details
.create_exchange(channel, config) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/liebre/common/utils.rb', line 4 def self.create_exchange channel, config exchange_name = config.fetch "name" type = config.fetch("type") opts = config.fetch("opts", {}) exchange_opts = symbolize_keys(opts.merge("type" => type)) channel.exchange exchange_name, exchange_opts end |
.symbolize_keys(hash) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/liebre/common/utils.rb', line 14 def self.symbolize_keys hash result = {} hash.each do |k, v| result[k.to_sym] = v.is_a?(Hash) ? symbolize_keys(v) : v end result end |