Sha256: 56b0accb47f6389025a8351746455531838339331dcccfb085597205ccaeaeb8

Contents?: true

Size: 1.37 KB

Versions: 33

Compression:

Stored size: 1.37 KB

Contents

# encoding: utf-8
module Mongoid
  module Extensions
    module ObjectId

      # Evolve the object id.
      #
      # @example Evolve the object id.
      #   object_id.__evolve_object_id__
      #
      # @return [ Moped::BSON::ObjectId ] self.
      #
      # @since 3.0.0
      def __evolve_object_id__
        self
      end
      alias :__mongoize_object_id__ :__evolve_object_id__

      module ClassMethods

        # Evolve the object into a mongo-friendly value to query with.
        #
        # @example Evolve the object.
        #   ObjectId.evolve(id)
        #
        # @param [ Object ] object The object to evolve.
        #
        # @return [ Moped::BSON::ObjectId ] The object id.
        #
        # @since 3.0.0
        def evolve(object)
          object.__evolve_object_id__
        end

        # Convert the object into a mongo-friendly value to store.
        #
        # @example Convert the object.
        #   ObjectId.mongoize(id)
        #
        # @param [ Object ] object The object to convert.
        #
        # @return [ Moped::BSON::ObjectId ] The object id.
        #
        # @since 3.0.0
        def mongoize(object)
          object.__mongoize_object_id__
        end
      end
    end
  end
end

Moped::BSON::ObjectId.__send__(:include, Mongoid::Extensions::ObjectId)
Moped::BSON::ObjectId.__send__(:extend, Mongoid::Extensions::ObjectId::ClassMethods)

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
mongoid-3.1.7 lib/mongoid/extensions/object_id.rb
mongoid-3.1.6 lib/mongoid/extensions/object_id.rb
mongoid-3.1.5 lib/mongoid/extensions/object_id.rb
mongoid_heroku_stable-4.0.0 lib/mongoid/extensions/object_id.rb
mongoid_rails4-4.0.0 lib/mongoid/extensions/object_id.rb
mongoid-3.1.4 lib/mongoid/extensions/object_id.rb
mongoid-3.1.3 lib/mongoid/extensions/object_id.rb
mongoid-3.1.2 lib/mongoid/extensions/object_id.rb
mongoid-3.0.23 lib/mongoid/extensions/object_id.rb
mongoid-3.1.1 lib/mongoid/extensions/object_id.rb
mongoid-3.1.0 lib/mongoid/extensions/object_id.rb
mongoid-3.0.22 lib/mongoid/extensions/object_id.rb
mongoid-3.0.21 lib/mongoid/extensions/object_id.rb
mongoid-3.0.20 lib/mongoid/extensions/object_id.rb
mongoid-3.0.19 lib/mongoid/extensions/object_id.rb
mongoid-3.0.18 lib/mongoid/extensions/object_id.rb
mongoid-3.0.17 lib/mongoid/extensions/object_id.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.16/lib/mongoid/extensions/object_id.rb
mongoid-3.0.16 lib/mongoid/extensions/object_id.rb
mongoid-3.0.15 lib/mongoid/extensions/object_id.rb