Class: Moqueue::MockExchange::BindingKey
- Inherits:
-
Object
- Object
- Moqueue::MockExchange::BindingKey
- Defined in:
- lib/moqueue/mock_exchange.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(key_string) ⇒ BindingKey
constructor
A new instance of BindingKey.
- #matches?(message_key) ⇒ Boolean
Constructor Details
#initialize(key_string) ⇒ BindingKey
Returns a new instance of BindingKey.
91 92 93 |
# File 'lib/moqueue/mock_exchange.rb', line 91 def initialize(key_string) @key = key_string.to_s.split(".") end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
89 90 91 |
# File 'lib/moqueue/mock_exchange.rb', line 89 def key @key end |
Instance Method Details
#==(other) ⇒ Object
95 96 97 |
# File 'lib/moqueue/mock_exchange.rb', line 95 def ==(other) other.respond_to?(:key) && other.key == @key end |
#matches?(message_key) ⇒ Boolean
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/moqueue/mock_exchange.rb', line 99 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 |