Sha256: 5eccf3dc2fe8caa865baf402d2edf661c0b4bebe283e844de878a7e1768f4d5f

Contents?: true

Size: 289 Bytes

Versions: 1

Compression:

Stored size: 289 Bytes

Contents

module Mongo
  module Voteable
    module Helpers

      def self.try_to_convert_string_to_object_id(x)
        x.is_a?(String) && BSON::ObjectId.legal?(x) ? BSON::ObjectId(x) : x
      end

      def self.get_mongo_id(x)
        x.respond_to?(:id) ? x.id : x
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voteable_mongo-0.9.3 lib/voteable_mongo/helpers.rb