Sha256: 7f2f7ede4f4831fd0991c1c98c27a5f3535ed53279c1235c030d15c5685a2557

Contents?: true

Size: 300 Bytes

Versions: 3

Compression:

Stored size: 300 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.from_string(x) : x
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rs_voteable_mongo-1.3.0 lib/voteable_mongo/helpers.rb
rs_voteable_mongo-1.2.0 lib/voteable_mongo/helpers.rb
rs_voteable_mongo-1.1.0 lib/voteable_mongo/helpers.rb