Sha256: 94ae3b926322d2dffc658be506edd031a1a77e978ca930204ad525978007a635

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

require 'sym/errors'
require 'base64'
require 'zlib'

require 'sym/data/wrapper_struct'
require 'sym/data/encoder'
require 'sym/data/decoder'

module Sym
  # 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,
  module Data
    def encode(data, compress: true)
      Encoder.new(data, compress).data_encoded
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sym-3.0.2 lib/sym/data.rb
sym-3.0.1 lib/sym/data.rb