Module: Secrets::Data

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

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