Sha256: 3dd569f959d2f5c8de81688244ca6ba4da24af17c58bd4e29a9dc3994dfde706
Contents?: true
Size: 704 Bytes
Versions: 1
Compression:
Stored size: 704 Bytes
Contents
module Stomper # Serializes Stomp Frames to an output stream. # Any object that responds appropriately to +write+ # can be used as the input stream. module FrameWriter # Writes a Stomp Frame to the underlying output stream. def transmit_frame(frame) write([ frame.command, Stomper::Frames::LINE_DELIMITER, serialize_headers(frame.headers), Stomper::Frames::LINE_DELIMITER, frame.body, Stomper::Frames::TERMINATOR.chr].join) end private def serialize_headers(headers) headers.inject("") do |acc, (key, val)| acc << "#{key}#{Stomper::Frames::HEADER_DELIMITER}#{val}#{Stomper::Frames::LINE_DELIMITER}" acc end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stomper-1.0.0 | lib/stomper/frame_writer.rb |