Sha256: a1a3706c27392774d4d63c8ffdca69ef0bcb97ab9840f17eb400903ca67db3eb

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

module StompServer
class StompFrame
  attr_accessor :command, :headers, :body
  def initialize(command=nil, headers=nil, body=nil)
    @command = command
    @headers = headers || {}
    @body = body || ''
    #
    @@log = Logger.new(STDOUT)
    @@log.level = StompServer::LogHelper.get_loglevel()
  end
 
  def to_s
    result = @command + "\n"
    # 1.8 / 1.9 compat
    @headers['content-length'] = @body.size.to_s if @body.include?(0.chr)
    @headers.each_pair do |key, value|
      result << "#{key}:#{value}\n"
    end
    result << "\n"
    result << @body.to_s
    result << "\000\n"  
  end
  
  def dest
    #@dest || (@dest = @headers['destination'])
    @headers['destination']
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stompserver_ng-1.0.6 lib/stomp_server_ng/stomp_frame.rb