class Fyrehose::ProtocolError

Constants

INFO_SIZE

Public Class Methods

new(buf=nil, pos=nil) click to toggle source
# File lib/fyrehose/errors.rb, line 9
def initialize(buf=nil, pos=nil)
  return unless buf
  offset = [0, pos - (INFO_SIZE / 2)].max
  @info = "\n    => "
  @info << buf[offset..offset + INFO_SIZE].gsub("\n", " ")
  @info << "\n#{" " * (pos - offset + 7)}^\n"
end

Public Instance Methods

to_s() click to toggle source
# File lib/fyrehose/errors.rb, line 17
def to_s
  "invalid token#{@info}"
end