class Ribbon::Intercom::Service::Channel::Stores::MockStore
Public Instance Methods
channels()
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 5 def channels @__channels ||= {} end
delete(channel)
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 26 def delete(channel) raise Errors::InvalidChannelError, channel.inspect unless channel.is_a?(Channel) channels.delete(channel.token) nil end
lock()
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 9 def lock @__lock ||= Mutex.new end
lookup_channel(token)
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 17 def lookup_channel(token) channels[token] end
persist(channel)
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 21 def persist(channel) raise Errors::InvalidChannelError, channel.inspect unless channel.is_a?(Channel) channels[channel.token] = channel end
token_exists?(token)
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 13 def token_exists?(token) channels.key?(token) end
with_lock(channel, &block)
click to toggle source
# File lib/ribbon/intercom/service/channel/stores/mock_store.rb, line 32 def with_lock(channel, &block) # This is a global lock, not a per-channel lock, but this store is only # for testing so let's KISS. lock.synchronize(&block) end