class Kazoo::StaticSubscription

StaticSubscription describes a subscription based on a static list of topic names.

Attributes

topic_names[R]

Public Class Methods

new(topic_names, **kwargs) click to toggle source

Instantiates a static subscription instance. The topic_names argument must be an array of strings.

Calls superclass method Kazoo::Subscription::new
# File lib/kazoo/subscription.rb, line 157
def initialize(topic_names, **kwargs)
  super(**kwargs)
  @topic_names = topic_names
end

Public Instance Methods

has_topic?(topic) click to toggle source
# File lib/kazoo/subscription.rb, line 162
def has_topic?(topic)
  topic_names.include?(topic.name)
end

Protected Instance Methods

pattern() click to toggle source
# File lib/kazoo/subscription.rb, line 168
def pattern
  :static
end
subscription() click to toggle source
# File lib/kazoo/subscription.rb, line 172
def subscription
  topic_names.inject({}) { |hash, topic_name| hash[topic_name] = 1; hash }
end