Class: MongoModel::InstrumentedCursor
- Inherits:
-
Object
- Object
- MongoModel::InstrumentedCursor
- Defined in:
- lib/mongomodel/support/instrumented_collection.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(cursor) ⇒ InstrumentedCursor
constructor
A new instance of InstrumentedCursor.
- #to_a ⇒ Object
Constructor Details
#initialize(cursor) ⇒ InstrumentedCursor
Returns a new instance of InstrumentedCursor.
10 11 12 |
# File 'lib/mongomodel/support/instrumented_collection.rb', line 10 def initialize(cursor) @cursor = cursor end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
27 28 29 |
# File 'lib/mongomodel/support/instrumented_collection.rb', line 27 def method_missing(method, *args, &block) cursor.send(method, *args, &block) end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
8 9 10 |
# File 'lib/mongomodel/support/instrumented_collection.rb', line 8 def cursor @cursor end |
Instance Method Details
#count ⇒ Object
20 21 22 23 24 |
# File 'lib/mongomodel/support/instrumented_collection.rb', line 20 def count instrument("count(#{cursor.selector.inspect})") do cursor.count end end |
#to_a ⇒ Object
14 15 16 17 18 |
# File 'lib/mongomodel/support/instrumented_collection.rb', line 14 def to_a instrument(query_description) do cursor.to_a end end |