Sha256: 00396a893f56cd7c0adce7283df412c907958b05804a1f2cadc7281ab8844ef1

Contents?: true

Size: 366 Bytes

Versions: 6

Compression:

Stored size: 366 Bytes

Contents

module Delayed
  module ShallowMongoid
    def self.dump(arg)
      if arg.is_a?(::Mongoid::Document)
        ShallowMongoid::DocumentStub.new(arg.class, arg._id.to_s)
      else
        arg
      end
    end
  
    def self.load(arg)
      if arg.is_a?(ShallowMongoid::DocumentStub)
        arg.klass.find(arg.id)
      else
        arg
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
delayed_job_shallow_mongoid-0.2.5 lib/delayed/shallow_mongoid.rb
delayed_job_shallow_mongoid-0.2.4 lib/delayed/shallow_mongoid.rb
delayed_job_shallow_mongoid-0.2.3 lib/delayed/shallow_mongoid.rb
delayed_job_shallow_mongoid-0.2.2 lib/delayed/shallow_mongoid.rb
delayed_job_shallow_mongoid-0.2.1 lib/delayed/shallow_mongoid.rb
delayed_job_shallow_mongoid-0.2.0 lib/delayed/shallow_mongoid.rb