Parent

Methods

Files

Moqueue::MockExchange::TopicBindingKey

Public Class Methods

new(key_string) click to toggle source
# File lib/moqueue/mock_exchange.rb, line 110
def initialize(key_string)
  @key = key_string.to_s.split(".")
end

Public Instance Methods

matches?(message_key) click to toggle source
# File lib/moqueue/mock_exchange.rb, line 114
def matches?(message_key)
  message_key, binding_key = message_key.split("."), key.dup

  match = true
  while match 
    binding_token, message_token = binding_key.shift, message_key.shift
    break if (binding_token.nil? && message_token.nil?) || (binding_token == "#")
    match = ((binding_token == message_token) || (binding_token == '*') || (message_token == '*'))
  end
  match
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.