Sha256: 645299690f96b3d2c41e9b4861056204ad2dd7727d8a788181afbc5b76c4839d

Contents?: true

Size: 1.25 KB

Versions: 48

Compression:

Stored size: 1.25 KB

Contents

module Mongo
  module ServerSelection
    module RTT

      # Represents a specification.
      #
      # @since 2.0.0
      class Spec

        # @return [ String ] description The spec description.
        attr_reader :description

        # @return [ Float ] avg_rtt_ms The starting average round trip time.
        attr_reader :avg_rtt_ms

        # @return [ Float ] new_rtt_ms The new round trip time for ismaster.
        attr_reader :new_rtt_ms

        # @return [ Float ] new_avg_rtt The newly calculated moving average round trip time.
        attr_reader :new_avg_rtt

        # Instantiate the new spec.
        #
        # @example Create the spec.
        #   Spec.new(file)
        #
        # @param [ String ] file The name of the file.
        #
        # @since 2.0.0
        def initialize(file)
          @test = YAML.load(ERB.new(File.new(file).read).result)
          @description = "avg_rtt_ms: #{@test['avg_rtt_ms']}, new_rtt_ms: #{@test['new_rtt_ms']}," +
                           " new_avg_rtt: #{@test['new_avg_rtt']}"
          @avg_rtt_ms = @test['avg_rtt_ms'] == 'NULL' ? nil : @test['avg_rtt_ms'].to_f
          @new_rtt_ms = @test['new_rtt_ms'].to_f
          @new_avg_rtt = @test['new_avg_rtt'].to_f
        end
      end
    end
  end
end

Version data entries

48 entries across 45 versions & 3 rubygems

Version Path
mongo-2.6.4 spec/support/server_selection_rtt.rb
mongo-2.6.2 spec/support/server_selection_rtt.rb
mongo-2.6.1 spec/support/server_selection_rtt.rb
mongo-2.6.0 spec/support/server_selection_rtt.rb
mongo-2.5.3 spec/support/server_selection_rtt.rb
mongo-2.5.2 spec/support/server_selection_rtt.rb
tdiary-5.0.8 vendor/bundle/gems/mongo-2.5.1/spec/support/server_selection_rtt.rb
mongo-2.5.1 spec/support/server_selection_rtt.rb
mongo-2.5.0 spec/support/server_selection_rtt.rb
mongo-2.5.0.beta spec/support/server_selection_rtt.rb
mongo-2.4.3 spec/support/server_selection_rtt.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/support/server_selection_rtt.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/support/server_selection_rtt.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/support/server_selection_rtt.rb
mongo-2.4.2 spec/support/server_selection_rtt.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/support/server_selection_rtt.rb
mongo-2.4.1 spec/support/server_selection_rtt.rb
mongo-2.4.0 spec/support/server_selection_rtt.rb
mongo-2.3.1 spec/support/server_selection_rtt.rb
mongo-2.4.0.rc1 spec/support/server_selection_rtt.rb