Module: AceMQ::AMQP::Wire Private

Defined in:
lib/acemq/amqp/transport.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The two rules about what a property looks like on the wire, shared by everything here that writes one.

Class Method Summary collapse

Class Method Details

.presence(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An empty property is absent rather than blank. A reply-to carrying "" is a reply-to somebody has to write a special case for at the other end, which is the same rule Envelope#to_headers follows for its headers.



379
380
381
382
# File 'lib/acemq/amqp/transport.rb', line 379

def presence(value)
  text = value.to_s
  text.empty? ? nil : text
end

.stringify(table) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Header and argument names go to the broker as strings, whatever they were written as here. A table keyed by :"x-message-ttl" is not the same table as one keyed by "x-message-ttl", and the broker only recognises the second — a symbol would silently become a queue argument nothing acts on.



370
371
372
373
374
# File 'lib/acemq/amqp/transport.rb', line 370

def stringify(table)
  return {} if table.nil? || table.empty?

  table.to_h { |name, value| [name.to_s, value] }
end