Sha256: 4a60b8a86f10ecc0375044f6fd26ce17dd1baef0ea8de999a921228cffd6638b

Contents?: true

Size: 384 Bytes

Versions: 1

Compression:

Stored size: 384 Bytes

Contents

module Delayed
  module ShallowMongoid
    def self.dump(arg)
      if arg.is_a?(::Mongoid::Document) && !arg.embedded?
        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

1 entries across 1 versions & 1 rubygems

Version Path
delayed_job_shallow_mongoid-0.2.6 lib/delayed/shallow_mongoid.rb