Sha256: b97da52ec73bb0683c20275ce9d6b9bc6070482255bca58505f466bb9cfd2f86
Contents?: true
Size: 758 Bytes
Versions: 2
Compression:
Stored size: 758 Bytes
Contents
module MongoDoc class Cursor include Enumerable attr_accessor :_collection, :_cursor delegate :admin, :close, :closed?, :count, :explain, :fields, :full_collection_name, :hint, :limit, :order, :query_options_hash, :query_opts, :selector, :skip, :snapshot, :sort, :timeout, :to => :_cursor def initialize(mongodoc_collection, cursor) self._collection = mongodoc_collection self._cursor = cursor end def collection _collection end def each _cursor.each do |next_document| yield MongoDoc::BSON.decode(next_document) end end def next_document MongoDoc::BSON.decode(_cursor.next_document) end def to_a MongoDoc::BSON.decode(_cursor.to_a) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongodoc-0.2.4 | lib/mongodoc/cursor.rb |
mongodoc-0.2.2 | lib/mongodoc/cursor.rb |