Sha256: 2d27341c8f2d21ba5772406c9b7661e1079f50b753b9a2f488a2f040462e8abb
Contents?: true
Size: 675 Bytes
Versions: 255
Compression:
Stored size: 675 Bytes
Contents
module WebMock class ResponsesSequence attr_accessor :times_to_repeat def initialize(responses) @times_to_repeat = 1 @responses = responses @current_position = 0 end def end? @times_to_repeat == 0 end def next_response if @times_to_repeat > 0 response = @responses[@current_position] increase_position response else @responses.last end end private def increase_position if @current_position == (@responses.length - 1) @current_position = 0 @times_to_repeat -= 1 else @current_position += 1 end end end end
Version data entries
255 entries across 244 versions & 17 rubygems