Class: Queight::ChannelWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/queight/channel_wrapper.rb

Overview

Adds memoization of exchanges etc.

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ ChannelWrapper

Returns a new instance of ChannelWrapper.



4
5
6
7
# File 'lib/queight/channel_wrapper.rb', line 4

def initialize(channel)
  super(channel)
  reset_cache!
end

Instance Method Details

#exchange(*args) ⇒ Object



13
14
15
# File 'lib/queight/channel_wrapper.rb', line 13

def exchange(*args)
  @exchange_cache[args] ||= super
end

#reset_cache!Object



9
10
11
# File 'lib/queight/channel_wrapper.rb', line 9

def reset_cache!
  @exchange_cache = {}
end