lib/mongo/operation/shared/executable.rb in mongo-2.6.4 vs lib/mongo/operation/shared/executable.rb in mongo-2.7.0.rc0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2015-2018 MongoDB, Inc. +# Copyright (C) 2015-2019 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -19,17 +19,25 @@ # # @since 2.5.2 module Executable def execute(server) - result = Result.new(dispatch_message(server)) + result = get_result(server) process_result(result, server) result.validate! end private + def result_class + Result + end + + def get_result(server) + result_class.new(dispatch_message(server)) + end + # Returns a Protocol::Message or nil def dispatch_message(server) server.with_connection do |connection| connection.dispatch([ message(server) ], operation_id) end @@ -41,6 +49,5 @@ result end end end end -