Class: Cod::SimpleSerializer
- Inherits:
-
Object
- Object
- Cod::SimpleSerializer
- Defined in:
- lib/cod/simple_serializer.rb
Overview
The simplest of all serializers, one that uses Marshal.dump and Marshal.load as a message format. Use this as a template for your own wire format serializers.
Instance Method Summary collapse
Instance Method Details
#de(io) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cod/simple_serializer.rb', line 11 def de(io) if block_given? Marshal.load(io, Proc.new) else Marshal.load(io) end end |
#en(obj) ⇒ Object
7 8 9 |
# File 'lib/cod/simple_serializer.rb', line 7 def en(obj) Marshal.dump(obj) end |