class ProtoPharm::ResponsesSequence
Attributes
repeat[RW]
responses[R]
Public Class Methods
new(responses)
click to toggle source
# File lib/proto_pharm/response_sequence.rb, line 8 def initialize(responses) @repeat = 1 @responses = responses @current = 0 @last = @responses.length - 1 end
Public Instance Methods
end?()
click to toggle source
# File lib/proto_pharm/response_sequence.rb, line 15 def end? @repeat == 0 end
next()
click to toggle source
# File lib/proto_pharm/response_sequence.rb, line 19 def next if @repeat > 0 response = @responses[@current] next_pos response else @responses.last end end
Private Instance Methods
next_pos()
click to toggle source
# File lib/proto_pharm/response_sequence.rb, line 31 def next_pos if @last == @current @current = 0 @repeat -= 1 else @current += 1 end end