Class: RLP::Sedes::Raw

Inherits:
Object
  • Object
show all
Includes:
Error, Utils
Defined in:
lib/rlp/sedes/raw.rb

Overview

A sedes that does nothing. Thus, everything that can be directly encoded by RLP is serializable. This sedes can be used as a placeholder when deserializing larger structures.

Instance Method Summary collapse

Methods included from Utils

#big_endian_to_int, #bytes_to_str, #encode_hex, #int_to_big_endian, #list?, make_immutable!, #primitive?, #str_to_bytes

Instance Method Details

#deserialize(serial) ⇒ Object


17
18
19
# File 'lib/rlp/sedes/raw.rb', line 17

def deserialize(serial)
  serial
end

#serialize(obj) ⇒ Object

Raises:


12
13
14
15
# File 'lib/rlp/sedes/raw.rb', line 12

def serialize(obj)
  raise SerializationError.new("Can only serialize nested lists of strings", obj) unless serializable?(obj)
  obj
end