Sha256: 5d36f38814d3f403362d1ddd3c1b1278b19af59bf8cd2d9fb676e884637c7383

Contents?: true

Size: 889 Bytes

Versions: 27

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

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

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongoid-7.3.5 lib/mongoid/association/marshalable.rb
mongoid-7.3.4 lib/mongoid/association/marshalable.rb
mongoid-7.1.11 lib/mongoid/association/marshalable.rb
mongoid-7.2.6 lib/mongoid/association/marshalable.rb
mongoid-7.3.3 lib/mongoid/association/marshalable.rb
mongoid-7.3.2 lib/mongoid/association/marshalable.rb
mongoid-7.2.5 lib/mongoid/association/marshalable.rb
mongoid-7.1.10 lib/mongoid/association/marshalable.rb
mongoid-7.1.9 lib/mongoid/association/marshalable.rb
mongoid-7.2.4 lib/mongoid/association/marshalable.rb
mongoid-7.3.1 lib/mongoid/association/marshalable.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/lib/mongoid/association/marshalable.rb
mongoid-7.3.0 lib/mongoid/association/marshalable.rb
mongoid-7.2.3 lib/mongoid/association/marshalable.rb
mongoid-7.1.8 lib/mongoid/association/marshalable.rb
mongoid-7.2.2 lib/mongoid/association/marshalable.rb
mongoid-7.2.1 lib/mongoid/association/marshalable.rb
mongoid-7.1.7 lib/mongoid/association/marshalable.rb
mongoid-7.2.0 lib/mongoid/association/marshalable.rb
mongoid-7.1.6 lib/mongoid/association/marshalable.rb