class Stomp::HeaderCodec
Purpose¶ ↑
A general CODEC for STOMP 1.1 header keys and values.
See:
for encode/decode rules.
Public Class Methods
Source
# File lib/stomp/codec.rb, line 30 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| # [encoded, decoded] os.gsub!(ev[i], ev[i+1]) end os end
decode decodes header data per the STOMP 1.1 specification.
Source
# File lib/stomp/codec.rb, line 19 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| # [encoded, decoded] os.gsub!(ev[i+1], ev[i]) end os end
encode encodes header data per the STOMP 1.1 specification.