Exception: Fyrehose::ProtocolError
- Defined in:
- lib/fyrehose/errors.rb
Constant Summary collapse
- INFO_SIZE =
30
Instance Method Summary collapse
-
#initialize(buf = nil, pos = nil) ⇒ ProtocolError
constructor
A new instance of ProtocolError.
- #to_s ⇒ Object
Constructor Details
#initialize(buf = nil, pos = nil) ⇒ ProtocolError
Returns a new instance of ProtocolError.
9 10 11 12 13 14 15 |
# 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 |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/fyrehose/errors.rb', line 17 def to_s "invalid token#{@info}" end |