module Mongo::Voteable::Helpers

Public Class Methods

get_mongo_id(x) click to toggle source
# File lib/voteable_mongo/helpers.rb, line 9
def self.get_mongo_id(x)
  x.respond_to?(:id) ? x.id : x
end
try_to_convert_string_to_object_id(x) click to toggle source
# File lib/voteable_mongo/helpers.rb, line 5
def self.try_to_convert_string_to_object_id(x)
  x.is_a?(String) && BSON::ObjectId.legal?(x) ? BSON::ObjectId.from_string(x) : x
end