Sha256: 2b0f68349f6776f94e4346cb43bbdeeff005032b16292a351cc7e38f82b2ee1e
Contents?: true
Size: 633 Bytes
Versions: 2
Compression:
Stored size: 633 Bytes
Contents
# frozen_string_literal: true module ProtoPharm class ResponsesSequence attr_accessor :repeat attr_reader :responses 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proto_pharm-0.7.0 | lib/proto_pharm/response_sequence.rb |
proto_pharm-0.6.0 | lib/proto_pharm/response_sequence.rb |