Class: MongoDoc::Cursor
- Includes:
- Enumerable
- Defined in:
- lib/mongo_doc/cursor.rb
Instance Attribute Summary collapse
-
#_collection ⇒ Object
Returns the value of attribute _collection.
-
#_cursor ⇒ Object
Returns the value of attribute _cursor.
Instance Method Summary collapse
- #collection ⇒ Object
- #each ⇒ Object
-
#initialize(mongo_doc_collection, cursor) ⇒ Cursor
constructor
A new instance of Cursor.
- #next_document ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(mongo_doc_collection, cursor) ⇒ Cursor
Returns a new instance of Cursor.
9 10 11 12 |
# File 'lib/mongo_doc/cursor.rb', line 9 def initialize(mongo_doc_collection, cursor) self._collection = mongo_doc_collection self._cursor = cursor end |
Instance Attribute Details
#_collection ⇒ Object
Returns the value of attribute _collection.
5 6 7 |
# File 'lib/mongo_doc/cursor.rb', line 5 def _collection @_collection end |
#_cursor ⇒ Object
Returns the value of attribute _cursor.
5 6 7 |
# File 'lib/mongo_doc/cursor.rb', line 5 def _cursor @_cursor end |
Instance Method Details
#collection ⇒ Object
14 15 16 |
# File 'lib/mongo_doc/cursor.rb', line 14 def collection _collection end |
#each ⇒ Object
18 19 20 21 22 |
# File 'lib/mongo_doc/cursor.rb', line 18 def each _cursor.each do |next_document| yield MongoDoc::BSON.decode(next_document) end end |