module Backrub

Constants

VERSION

Attributes

store[W]

Public Instance Methods

publish(channel, message) click to toggle source
# File lib/backrub.rb, line 23
def publish(channel, message)
  store.publish(channel, message)
end
store() click to toggle source
# File lib/backrub.rb, line 9
def store
  @store ||= Backrub::Store::Redis.new
end
subscribe(channels_with_backlog, &block) click to toggle source
# File lib/backrub.rb, line 13
def subscribe(channels_with_backlog, &block)
  channels_with_backlog.each do |channel, count|
    store.backlog(channel.to_s, count.to_i, &block) unless count.zero?
  end

  channels = channels_with_backlog.keys.map(&:to_s)

  store.subscribe(*channels, &block)
end