Module: Shhh::Data

Included in:
Extensions::InstanceMethods
Defined in:
lib/shhh/data.rb,
lib/shhh/data/encoder.rb,
lib/shhh/data/decoder.rb,
lib/shhh/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/shhh/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/shhh/data.rb', line 14

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