Module: Sym::Data

Included in:
Extensions::InstanceMethods
Defined in:
lib/sym/data.rb,
lib/sym/data/decoder.rb,
lib/sym/data/encoder.rb,
lib/sym/data/wrapper_struct.rb

Overview

This module is responsible for taking arbitrary data of any format, and safely compressing the result of ‘Marshal.dump(data)` using Zlib, and then doing `#urlsafe_encode64` encoding to convert it to a string,

Defined Under Namespace

Classes: Decoder, Encoder, WrapperStruct

Instance Method Summary collapse

Instance Method Details

#decode(data_encoded, compress: nil) ⇒ Object



18
19
20
# File 'lib/sym/data.rb', line 18

def decode(data_encoded, compress: nil)
  Decoder.new(data_encoded, compress).data
end

#encode(data, compress: true) ⇒ Object



14
15
16
# File 'lib/sym/data.rb', line 14

def encode(data, compress: true)
  Encoder.new(data, compress).data_encoded
end