Sha256: 6b768346d08256f6063b7d334ba92b1feaebe9e7ba1466d6035f944680efc7cc

Contents?: true

Size: 811 Bytes

Versions: 24

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

module Mongoid
  module Association
    module Marshalable

      # Provides the data needed to Marshal.dump an association proxy.
      #
      # @example Dump the proxy.
      #   Marshal.dump(proxy)
      #
      # @return [ Array<Object> ] The dumped data.
      def marshal_dump
        [ _base, _target, _association ]
      end

      # 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.
      def marshal_load(data)
        @_base, @_target, @_association = data
        extend_proxy(_association.extension) if _association.extension
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
mongoid-8.1.7 lib/mongoid/association/marshalable.rb
mongoid-8.1.6 lib/mongoid/association/marshalable.rb
mongoid-8.0.8 lib/mongoid/association/marshalable.rb
mongoid-8.1.5 lib/mongoid/association/marshalable.rb
mongoid-8.1.4 lib/mongoid/association/marshalable.rb
mongoid-8.0.7 lib/mongoid/association/marshalable.rb
mongoid-8.1.3 lib/mongoid/association/marshalable.rb
mongoid-8.1.2 lib/mongoid/association/marshalable.rb
mongoid-8.0.6 lib/mongoid/association/marshalable.rb
mongoid-7.5.4 lib/mongoid/association/marshalable.rb
mongoid-8.1.1 lib/mongoid/association/marshalable.rb
mongoid-8.0.5 lib/mongoid/association/marshalable.rb
mongoid-8.1.0 lib/mongoid/association/marshalable.rb
mongoid-7.5.3 lib/mongoid/association/marshalable.rb
mongoid-8.0.4 lib/mongoid/association/marshalable.rb
mongoid-8.0.3 lib/mongoid/association/marshalable.rb
mongoid-7.5.2 lib/mongoid/association/marshalable.rb
mongoid-8.0.2 lib/mongoid/association/marshalable.rb
mongoid-7.5.1 lib/mongoid/association/marshalable.rb
mongoid-7.4.3 lib/mongoid/association/marshalable.rb