class Stomp::HeaderCodec

Purpose

A general CODEC for STOMP 1.1 header keys and values.

See:

for encode/decode rules.

Public Class Methods

decode(in_string = nil) click to toggle source

Decode header data per STOMP 1.1 specification

# File lib/stomp/codec.rb, line 28
def self.decode(in_string = nil)
  return in_string unless in_string
  ev = Stomp::DECODE_VALUES # avoid typing below
  os = in_string + ""
  0.step(ev.length-2,2) do |i|
    os.gsub!(ev[i+1], ev[i])
  end
  os
end
encode(in_string = nil) click to toggle source

Encode header data per STOMP 1.1 specification

# File lib/stomp/codec.rb, line 17
def self.encode(in_string = nil)
  return in_string unless in_string
  ev = Stomp::ENCODE_VALUES # avoid typing below
  os = in_string + ""
  0.step(ev.length-2,2) do |i|
    os.gsub!(ev[i], ev[i+1])
  end
  os
end