lib/mongo/monitoring/event/server_heartbeat_succeeded.rb in mongo-2.13.0.beta1 vs lib/mongo/monitoring/event/server_heartbeat_succeeded.rb in mongo-2.13.0.rc1

- old
+ new

@@ -28,23 +28,30 @@ attr_reader :round_trip_time # Alias of round_trip_time. alias :duration :round_trip_time + # @return [ true | false ] Whether the heartbeat was awaited. + def awaited? + @awaited + end + # Create the event. # # @example Create the event. # ServerHeartbeatSucceeded.new(address, duration) # # @param [ Address ] address The server address. # @param [ Float ] round_trip_time Duration of ismaster call in seconds. + # @param [ true | false ] awaited Whether the heartbeat was awaited. # # @since 2.7.0 # @api private - def initialize(address, round_trip_time) + def initialize(address, round_trip_time, awaited: false) @address = address @round_trip_time = round_trip_time + @awaited = !!awaited end # Returns a concise yet useful summary of the event. # # @return [ String ] String summary of the event. @@ -52,10 +59,10 @@ # @note This method is experimental and subject to change. # # @since 2.7.0 # @api experimental def summary - "#<#{self.class.name.sub(/^Mongo::Monitoring::Event::/, '')}" + + "#<#{short_class_name}" + " address=#{address}>" end end end end