module Warren::Handler

A {Warren::Handler} provides an interface for sending messages to either a message queue, a log, or an internal store for testing purposes.

Public Class Methods

routing_key_template(prefix) click to toggle source

Generates a template for routing keys for the given prefix, or a template that returns the provided routing key if no prefix is supplied.

@example With a prefix

template = Warren::Handler.routing_key_template('example') # => 'example.%s'
format(template, 'routing.key') #=> 'example.routing.key'

@example Without a prefix

template = Warren::Handler.routing_key_template(nil) # => '%s'
format(template, 'routing.key') #=> 'routing.key'

@param prefix [String, nil] The prefix to use in the template

@return [String] A template for generating routing keys

# File lib/warren/handler.rb, line 26
def self.routing_key_template(prefix)
  prefix ? "#{prefix}.%s" : '%s'
end