module Property::Serialization::Marshal::Encoder

Public Instance Methods

decode_properties(string) click to toggle source

Decode Marshal encoded properties

# File lib/property/serialization/marshal.rb, line 23
def decode_properties(string)
  ::Marshal::load(string.unpack('m')[0])
end
encode_properties(properties) click to toggle source

Encode properties with Marhsal

# File lib/property/serialization/marshal.rb, line 16
def encode_properties(properties)
  # we limit dump depth to 0 (object only: no instance variables)
  # we have to protect Marshal from serializing instance variables by making a copy
  [::Marshal::dump(Properties[properties])].pack('m*')
end