module Mongoid::Relations::Marshalable

Public Instance Methods

marshal_dump() click to toggle source

Provides the data needed to Marshal.dump a relation proxy.

@example Dump the proxy.

Marshal.dump(proxy)

@return [ Array<Object> ] The dumped data.

@since 3.0.15

# File lib/mongoid/relations/marshalable.rb, line 14
def marshal_dump
  [ base, target, __metadata ]
end
marshal_load(data) click to toggle source

Takes the provided data and sets it back on the proxy.

@example Load the proxy.

Marshal.load(proxy)

@return [ Array<Object> ] The loaded data.

@since 3.0.15

# File lib/mongoid/relations/marshalable.rb, line 26
def marshal_load(data)
  @base, @target, @__metadata = data
  extend_proxy(__metadata.extension) if __metadata.extension?
end