Module: Mongo::Operation::Executable
- Included in:
- Commands::CollectionsInfo, Commands::Command, Commands::UserQuery, KillCursors, Read::GetMore, Read::Query
- Defined in:
- lib/mongo/operation/executable.rb
Overview
This module provides the #execute method that many operations use. It makes sure to instantiate the appropriate Result class for the operation’s response.
Instance Method Summary collapse
-
#execute(context) ⇒ Result
Execute the operation.
Instance Method Details
#execute(context) ⇒ Result
Execute the operation. The context gets a connection on which the operation is sent in the block.
33 34 35 36 37 38 |
# File 'lib/mongo/operation/executable.rb', line 33 def execute(context) context.with_connection do |connection| result_class = self.class.const_defined?(:Result, false) ? self.class::Result : Result result_class.new(connection.dispatch([ (context) ], operation_id)).validate! end end |