Sha256: ee547ece501afed7dbf16f9701b3545283f0bd75bc7eac5e3e0aeeacc9d4f841

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

# -*- encoding: utf-8 -*-

module Stomp
  #
  # == Purpose
  #
  # A general CODEC for STOMP 1.1 header keys and values.
  #
  # See:
  #
  # * http://stomp.github.com/index.html
  #
  # for encode/decode rules.
  #
  class HeaderCodec

    public

    # encode encodes header data per the STOMP 1.1 specification.
    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

    # decode decodes header data per the STOMP 1.1 specification.
    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

  end # of class HeaderCodec

end # of module Stomp

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stomp-1.2.7 lib/stomp/codec.rb
stomp-1.2.6 lib/stomp/codec.rb
stomp-1.2.5 lib/stomp/codec.rb