Class: OnStomp::Connections::Serializers::Stomp_1_0
- Inherits:
-
Object
- Object
- OnStomp::Connections::Serializers::Stomp_1_0
- Includes:
- Stomp_1
- Defined in:
- lib/onstomp/connections/serializers/stomp_1_0.rb
Overview
Frame serializer / parser for STOMP 1.0 connections.
Instance Method Summary (collapse)
-
- (String) frame_to_string(frame)
Converts a frame to a string.
-
- (Stomp_1_0) initialize
constructor
Creates a new serializer and calls OnStomp::Connections::Serializers::Stomp_1#reset_parser.
-
- (nil) prepare_parsed_frame(frame)
Nothing special needs to be done with frames parsed from a STOMP 1.0 connection, so this is a no-op.
-
- ([String, String]) split_header(str)
Splits a header line into a header name / header value pair at the first ':' character and returns the pair.
Methods included from Stomp_1
#bytes_to_frame, #finish_body, #finish_command, #finish_header_line, #frame_to_bytes, #frame_to_string_base, #parse_body, #parse_command, #parse_header_line, #parser_flush, #reset_parser
Constructor Details
- (Stomp_1_0) initialize
Creates a new serializer and calls OnStomp::Connections::Serializers::Stomp_1#reset_parser
8 9 10 |
# File 'lib/onstomp/connections/serializers/stomp_1_0.rb', line 8 def initialize reset_parser end |
Instance Method Details
- (String) frame_to_string(frame)
Converts a frame to a string
15 16 17 18 19 |
# File 'lib/onstomp/connections/serializers/stomp_1_0.rb', line 15 def frame_to_string frame frame_to_string_base(frame) do |k,v| "#{k.gsub(/[\n:]/, '')}:#{v.gsub(/\n/, '')}\n" end end |
- (nil) prepare_parsed_frame(frame)
Nothing special needs to be done with frames parsed from a STOMP 1.0 connection, so this is a no-op.
39 40 |
# File 'lib/onstomp/connections/serializers/stomp_1_0.rb', line 39 def prepare_parsed_frame frame end |
- ([String, String]) split_header(str)
Splits a header line into a header name / header value pair at the first ':' character and returns the pair.
27 28 29 30 31 32 33 |
# File 'lib/onstomp/connections/serializers/stomp_1_0.rb', line 27 def split_header(str) col = str.index(':') unless col raise OnStomp::MalformedHeaderError, "unterminated header: '#{str}'" end [ str[0...col], str[(col+1)..-1] ] end |