Class: BPS::Publisher::InMem::Topic

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract::Topic

#flush

Constructor Details

#initialize(name) ⇒ Topic

Returns a new instance of Topic.


7
8
9
10
11
# File 'lib/bps/publisher/in_mem.rb', line 7

def initialize(name)
  super()
  @name = name.to_s
  @messages = []
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.


5
6
7
# File 'lib/bps/publisher/in_mem.rb', line 5

def messages
  @messages
end

#nameObject (readonly)

Returns the value of attribute name.


5
6
7
# File 'lib/bps/publisher/in_mem.rb', line 5

def name
  @name
end

Instance Method Details

#publish(message) ⇒ Object

Publish a message.


14
15
16
# File 'lib/bps/publisher/in_mem.rb', line 14

def publish(message, **)
  @messages.push(message.to_s)
end