Sha256: 688a7d0895d692c40d87817216f46229528b4a221100b88d94f199fce9da5bb3
Contents?: true
Size: 604 Bytes
Versions: 13
Compression:
Stored size: 604 Bytes
Contents
# frozen_string_literal: true module GrpcMock class ResponsesSequence attr_accessor :repeat def initialize(responses) @repeat = 1 @responses = responses @current = 0 @last = @responses.length - 1 end def end? @repeat == 0 end def next if @repeat > 0 response = @responses[@current] next_pos response else @responses.last end end private def next_pos if @last == @current @current = 0 @repeat -= 1 else @current += 1 end end end end
Version data entries
13 entries across 13 versions & 3 rubygems