Provides the data needed to Marshal.dump a criteria.
@example Dump the criteria.
Marshal.dump(criteria)
@return [ Array<Object> ] The dumped data.
@since 3.0.15
# File lib/mongoid/criterion/marshalable.rb, line 13 def marshal_dump data = [ klass, driver, inclusions, documents, strategy, negating ] data.push(scoping_options).push(dump_hash(:selector)).push(dump_hash(:options)) end
Resets the criteria object after a Marshal.load
@example Load the criteria.
Marshal.load(criteria)
@since 3.0.15
# File lib/mongoid/criterion/marshalable.rb, line 24 def marshal_load(data) @scoping_options, raw_selector, raw_options = data.pop(3) @klass, @driver, @inclusions, @documents, @strategy, @negating = data @selector = load_hash(Origin::Selector, raw_selector) @options = load_hash(Origin::Options, raw_options) end