module Mongoid::Association::Marshalable

Public Instance Methods

marshal_dump() click to toggle source

Provides the data needed to Marshal.dump an association proxy.

@example Dump the proxy.

Marshal.dump(proxy)

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

@since 3.0.15

# File lib/mongoid/association/marshalable.rb, line 16
def marshal_dump
  [ _base, _target, _association ]
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)

@param [ Array<Object> ] data The data to set on the proxy.

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

@since 3.0.15

# File lib/mongoid/association/marshalable.rb, line 30
def marshal_load(data)
  @_base, @_target, @_association = data
  extend_proxy(_association.extension) if _association.extension
end