class RLP::Sedes::Raw
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.
Public Instance Methods
deserialize(serial)
click to toggle source
# File lib/rlp/sedes/raw.rb, line 18 def deserialize(serial) serial end
serialize(obj)
click to toggle source
# File lib/rlp/sedes/raw.rb, line 13 def serialize(obj) raise SerializationError.new("Can only serialize nested lists of strings", obj) unless serializable?(obj) obj end
Private Instance Methods
serializable?(obj)
click to toggle source
# File lib/rlp/sedes/raw.rb, line 24 def serializable?(obj) return true if primitive?(obj) return obj.all? {|item| serializable?(item) } if list?(obj) false end