Class: Moqueue::MockExchange::TopicBindingKey
- Inherits:
-
Object
- Object
- Moqueue::MockExchange::TopicBindingKey
- Includes:
- BaseKey
- Defined in:
- lib/moqueue/mock_exchange.rb
Instance Attribute Summary
Attributes included from BaseKey
Instance Method Summary collapse
-
#initialize(key_string) ⇒ TopicBindingKey
constructor
A new instance of TopicBindingKey.
- #matches?(message_key) ⇒ Boolean
Methods included from BaseKey
Constructor Details
#initialize(key_string) ⇒ TopicBindingKey
Returns a new instance of TopicBindingKey.
110 111 112 |
# File 'lib/moqueue/mock_exchange.rb', line 110 def initialize(key_string) @key = key_string.to_s.split(".") end |
Instance Method Details
#matches?(message_key) ⇒ Boolean
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/moqueue/mock_exchange.rb', line 114 def matches?() , binding_key = .split("."), key.dup match = true while match binding_token, = binding_key.shift, .shift break if (binding_token.nil? && .nil?) || (binding_token == "#") match = ((binding_token == ) || (binding_token == '*') || ( == '*')) end match end |