Module: StompParser
- Defined in:
- lib/stomp_parser.rb,
lib/stomp_parser/error.rb,
lib/stomp_parser/frame.rb,
lib/stomp_parser/version.rb,
lib/stomp_parser/ruby_parser.rb
Defined Under Namespace
Classes: CParser, Error, Frame, FrameSizeExceeded, ParseError, RubyParser
Constant Summary collapse
- Parser =
if defined?(CParser) CParser elsif defined?(JavaParser) JavaParser else RubyParser end
- VERSION =
"1.0.0"
Class Attribute Summary collapse
-
.max_frame_size ⇒ Object
Returns the value of attribute max_frame_size.
Class Method Summary collapse
-
.build_parse_error(chunk, index) ⇒ ParseError
private
Create a parse error from a string chunk and an index.
Class Attribute Details
.max_frame_size ⇒ Object
Returns the value of attribute max_frame_size.
25 26 27 |
# File 'lib/stomp_parser.rb', line 25 def max_frame_size @max_frame_size end |
Class Method Details
.build_parse_error(chunk, index) ⇒ ParseError
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a parse error from a string chunk and an index.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/stomp_parser.rb', line 33 def build_parse_error(chunk, index) ctx = 7 min = [0, index - ctx].max len = ctx + 1 + ctx context = chunk.byteslice(min, len).force_encoding("BINARY") idx = index - min chr = context[idx] context[idx] = " -->#{chr}<-- " ParseError.new("unexpected #{chr} in chunk (#{context.inspect})") end |