Class: BunnyMock::Exchanges::Topic
- Inherits:
-
BunnyMock::Exchange
- Object
- BunnyMock::Exchange
- BunnyMock::Exchanges::Topic
- Defined in:
- lib/bunny_mock/exchanges/topic.rb
Instance Attribute Summary
Attributes inherited from BunnyMock::Exchange
#arguments, #auto_delete, #channel, #durable, #internal, #name, #opts, #type
Instance Method Summary collapse
-
#deliver(payload, opts, key) ⇒ Object
Deliver a message to route with keys matching wildcards.
Methods inherited from BunnyMock::Exchange
#bind, #bound_to?, declare, #delete, #has_binding?, #publish, #routes_to?, #unbind
Instance Method Details
#deliver(payload, opts, key) ⇒ Object
Deliver a message to route with keys matching wildcards
26 27 28 29 |
# File 'lib/bunny_mock/exchanges/topic.rb', line 26 def deliver(payload, opts, key) delivery_routes = @routes.dup.keep_if { |route, _| key =~ route_to_regex(route) } delivery_routes.values.flatten.each { |dest| dest.publish(payload, opts) } end |