Module: Mongoid::Relations::Marshalable

Included in:
Proxy
Defined in:
lib/mongoid/relations/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 'lib/mongoid/relations/marshalable.rb', line 14

def marshal_dump
  [ base, target,  ]
end

#marshal_load(data) ⇒ Array<Object>

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

Examples:

Load the proxy.

Marshal.load(proxy)

Returns:

  • (Array<Object>)

    The loaded data.

Since:

  • 3.0.15



26
27
28
29
# File 'lib/mongoid/relations/marshalable.rb', line 26

def marshal_load(data)
  @base, @target, @metadata = data
  extend_proxy(.extension) if .extension?
end