Sha256: 8c40408f0243694eaf9cd8994428cfa2759e43d4384878ce9b122f1f20d01ce5

Contents?: true

Size: 534 Bytes

Versions: 16

Compression:

Stored size: 534 Bytes

Contents

module Mongoid
  module Contexts
    module IdConversion
      protected

      # Convert ids from strings to +BSON::ObjectID+s
      def strings_to_object_ids(ids)
        if Array === ids
          ids.map {|id| string_to_object_id(id) }
        else
          string_to_object_id(ids)
        end

      end

      # Convert ids from strings to +BSON::ObjectID+s
      def string_to_object_id(id)
        if String === id
          ::BSON::ObjectID.from_string(id)
        else
          id
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mongo_doc-0.6.28 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.27 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.26 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.25 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.23 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.22 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.21 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.20 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.19 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.18 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.17 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.16 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.15 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.14 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.13 lib/mongoid/contexts/id_conversion.rb
mongo_doc-0.6.12 lib/mongoid/contexts/id_conversion.rb