Sha256: 13b2e077624ad1f6f07c37e299b8905ffb388fa9407c9334307c25743cac990a

Contents?: true

Size: 416 Bytes

Versions: 5

Compression:

Stored size: 416 Bytes

Contents

# typed: true

module Datadog
  module Core
    module Utils
      # Generates values from a consistent sequence
      class Sequence
        def initialize(seed = 0, &block)
          @current = seed
          @next_item = block
        end

        def next
          next_item = @next_item ? @next_item.call(@current) : @current
          @current += 1
          next_item
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-1.3.0 lib/datadog/core/utils/sequence.rb
ddtrace-1.2.0 lib/datadog/core/utils/sequence.rb
ddtrace-1.1.0 lib/datadog/core/utils/sequence.rb
ddtrace-1.0.0 lib/datadog/core/utils/sequence.rb
ddtrace-1.0.0.beta2 lib/datadog/core/utils/sequence.rb