Module: Mongoid::Association::Marshalable

Included in:
Proxy
Defined in:
build/mongoid-7.0/lib/mongoid/association/marshalable.rb

Instance Method Summary collapse

Instance Method Details

#marshal_dumpArray<Object>

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

Examples:

Dump the proxy.

Marshal.dump(proxy)

Returns:

  • (Array<Object>)

    The dumped data.

Since:

  • 3.0.15



14
15
16
# File 'build/mongoid-7.0/lib/mongoid/association/marshalable.rb', line 14

def marshal_dump
  [ _base, _target, _association ]
end

#marshal_load(data) ⇒ Array<Object>

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

Examples:

Load the proxy.

Marshal.load(proxy)

Parameters:

  • data (Array<Object>)

    The data to set on the proxy.

Returns:

  • (Array<Object>)

    The loaded data.

Since:

  • 3.0.15



28
29
30
31
# File 'build/mongoid-7.0/lib/mongoid/association/marshalable.rb', line 28

def marshal_load(data)
  @_base, @_target, @_association = data
  extend_proxy(_association.extension) if _association.extension
end