Class: ObjCursor

Inherits:
Object show all
Includes:
FromHash
Defined in:
lib/mongo_persist/mongo_ext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FromHash

#after_initialize, #from_hash, #initialize

Instance Attribute Details

#cursorObject

Returns the value of attribute cursor.



2
3
4
# File 'lib/mongo_persist/mongo_ext.rb', line 2

def cursor
  @cursor
end

Instance Method Details

#countObject



12
13
14
# File 'lib/mongo_persist/mongo_ext.rb', line 12

def count
  cursor.count
end

#eachObject



4
5
6
# File 'lib/mongo_persist/mongo_ext.rb', line 4

def each
  cursor.each { |x| yield(x.to_mongo_object) }
end

#to_aObject



7
8
9
10
11
# File 'lib/mongo_persist/mongo_ext.rb', line 7

def to_a
  res = []
  each { |x| res << x }
  res
end