Method: MongoDoc::ReferencesMany.ids_from_strings_or_ids

Defined in:
lib/mongo_doc/references_many.rb

.ids_from_strings_or_ids(ids_or_strings) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mongo_doc/references_many.rb', line 12

def self.ids_from_strings_or_ids(ids_or_strings)
  if ids_or_strings.blank?
    []
  else
    ids_or_strings.map do |item|
      if String === item
        ::BSON::ObjectId.cast_from_string(item)
      else
        item
      end
    end
  end
end