Class: FakeSmith
- Inherits:
-
Object
- Object
- FakeSmith
- Defined in:
- lib/fake_smith.rb,
lib/fake_smith/version.rb
Defined Under Namespace
Classes: Logger
Constant Summary collapse
- VERSION =
"0.0.7"
Class Method Summary collapse
- .add_message(queue_name, message) ⇒ Object
- .clear_all ⇒ Object
- .define_subscription(queue_name, &blk) ⇒ Object
- .get_messages(queue_name) ⇒ Object
- .send_message(queue_name, payload, receiver) ⇒ Object
- .subscribed_queues ⇒ Object
Class Method Details
.add_message(queue_name, message) ⇒ Object
17 18 19 20 |
# File 'lib/fake_smith.rb', line 17 def self.(queue_name, ) [queue_name] ||= [] [queue_name] << end |
.clear_all ⇒ Object
22 23 24 25 |
# File 'lib/fake_smith.rb', line 22 def self.clear_all clear_subscriptions end |
.define_subscription(queue_name, &blk) ⇒ Object
9 10 11 |
# File 'lib/fake_smith.rb', line 9 def self.define_subscription(queue_name, &blk) subscriptions[queue_name] = blk end |
.get_messages(queue_name) ⇒ Object
13 14 15 |
# File 'lib/fake_smith.rb', line 13 def self.(queue_name) [queue_name] ||= [] end |
.send_message(queue_name, payload, receiver) ⇒ Object
4 5 6 7 |
# File 'lib/fake_smith.rb', line 4 def self.(queue_name, payload, receiver) raise "no subscribers on queue: #{queue_name}" unless subscriptions[queue_name] subscriptions[queue_name].call(payload, receiver) end |
.subscribed_queues ⇒ Object
27 28 29 |
# File 'lib/fake_smith.rb', line 27 def self.subscribed_queues subscriptions.keys end |