Class: SXS::Publishers::Memory

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sxs/publishers/memory.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue_url) ⇒ Memory



12
13
14
# File 'lib/sxs/publishers/memory.rb', line 12

def initialize(queue_url)
  @queue_url = queue_url
end

Instance Attribute Details

#queue_urlObject (readonly)

Returns the value of attribute queue_url.



8
9
10
# File 'lib/sxs/publishers/memory.rb', line 8

def queue_url
  @queue_url
end

Class Method Details

.clearObject



25
26
27
# File 'lib/sxs/publishers/memory.rb', line 25

def self.clear
  @queues = {}
end

.queuesObject



29
30
31
# File 'lib/sxs/publishers/memory.rb', line 29

def self.queues
  @queues ||= {}
end

Instance Method Details

#messagesObject



16
17
18
# File 'lib/sxs/publishers/memory.rb', line 16

def messages
  self.class.queues[@queue_url]
end

#publish(body) ⇒ Object



20
21
22
23
# File 'lib/sxs/publishers/memory.rb', line 20

def publish(body)
  self.class.queues[@queue_url] ||= []
  self.class.queues[@queue_url] << body
end