Module: Mongoid::Criterion::Marshalable
- Included in:
- Mongoid::Criteria
- Defined in:
- lib/mongoid/criterion/marshalable.rb
Instance Method Summary collapse
-
#marshal_dump ⇒ Array<Object>
Provides the data needed to Marshal.dump a criteria.
-
#marshal_load(data) ⇒ Object
Resets the criteria object after a Marshal.load.
Instance Method Details
#marshal_dump ⇒ Array<Object>
Provides the data needed to Marshal.dump a criteria.
14 15 16 17 |
# File 'lib/mongoid/criterion/marshalable.rb', line 14 def marshal_dump data = [ klass, driver, inclusions, documents, strategy, negating ] data.push().push(dump_hash(:selector)).push(dump_hash(:options)) end |
#marshal_load(data) ⇒ Object
Resets the criteria object after a Marshal.load
25 26 27 28 29 30 |
# File 'lib/mongoid/criterion/marshalable.rb', line 25 def marshal_load(data) @scoping_options, raw_selector, = data.pop(3) @klass, @driver, @inclusions, @documents, @strategy, @negating = data @selector = load_hash(Origin::Selector, raw_selector) @options = load_hash(Origin::Options, ) end |