Method: Cborb::Decoding::State#<<

Defined in:
lib/cborb/decoding/state.rb

#<<(cbor) ⇒ Object

Buffering new CBOR data

Parameters:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cborb/decoding/state.rb', line 21

def <<(cbor)
  @buffer.write(cbor)
  @decoding_fiber.resume

rescue FiberError => e
  msg = e.message

  # umm...
  if msg.include?("dead")
    raise Cborb::InvalidByteSequenceError
  elsif msg.include?("threads")
    raise Cborb::DecodingError, "Can't decode across threads"
  else
    raise
  end
end