Class: RosettaQueue::Gateway::FakeAdapter
- Inherits:
-
Object
- Object
- RosettaQueue::Gateway::FakeAdapter
- Defined in:
- lib/rosetta_queue/adapters/fake.rb
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(adapter_settings = {}) ⇒ FakeAdapter
constructor
A new instance of FakeAdapter.
- #messages_sent_to(queue) ⇒ Object
- #open? ⇒ Boolean
- #queues ⇒ Object
- #send_message(queue, message, headers) ⇒ Object
Constructor Details
#initialize(adapter_settings = {}) ⇒ FakeAdapter
Returns a new instance of FakeAdapter.
6 7 8 9 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 6 def initialize(adapter_settings = {}) @messages = [] @open = true end |
Instance Method Details
#disconnect ⇒ Object
23 24 25 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 23 def disconnect @open = false end |
#messages_sent_to(queue) ⇒ Object
15 16 17 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 15 def (queue) (queue ? @messages.select{|| ['queue'] == queue} : @messages).map{|m| m['message']} end |
#open? ⇒ Boolean
27 28 29 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 27 def open? @open == true end |
#queues ⇒ Object
19 20 21 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 19 def queues @messages.map {|| ['queue']} end |
#send_message(queue, message, headers) ⇒ Object
11 12 13 |
# File 'lib/rosetta_queue/adapters/fake.rb', line 11 def (queue, , headers) @messages << {'queue' => queue, 'message' => RosettaQueue::Filters::process_receiving(), 'headers' => headers} end |