Class: BPS::Publisher::InMem

Inherits:
Abstract show all
Defined in:
lib/bps/publisher/in_mem.rb

Defined Under Namespace

Classes: Topic

Instance Method Summary collapse

Methods inherited from Abstract

#close

Constructor Details

#initializeInMem

Returns a new instance of InMem.


19
20
21
22
# File 'lib/bps/publisher/in_mem.rb', line 19

def initialize
  super()
  @topics = {}
end

Instance Method Details

#topic(name) ⇒ Object

Retrieve a topic handle.


31
32
33
34
35
36
37
38
# File 'lib/bps/publisher/in_mem.rb', line 31

def topic(name)
  name = name.to_s

  @topics[name] ||= begin
    @topic_names = nil
    self.class::Topic.new(name)
  end
end

#topic_namesArray<String>

Returns the existing topic names.

Returns:

  • (Array<String>)

    the existing topic names.


25
26
27
# File 'lib/bps/publisher/in_mem.rb', line 25

def topic_names
  @topic_names ||= @topics.keys.sort
end