Parent

Files

WebMock::ResponsesSequence

Attributes

times_to_repeat[RW]

Public Class Methods

new(responses) click to toggle source
    # File lib/webmock/responses_sequence.rb, line 7
 7:     def initialize(responses)
 8:       @times_to_repeat = 1
 9:       @responses = responses
10:       @current_position = 0
11:     end

Public Instance Methods

end?() click to toggle source
    # File lib/webmock/responses_sequence.rb, line 13
13:     def end?
14:       @times_to_repeat == 0
15:     end
next_response() click to toggle source
    # File lib/webmock/responses_sequence.rb, line 17
17:     def next_response
18:       if @times_to_repeat > 0
19:         response = @responses[@current_position]
20:         increase_position
21:         response
22:       else
23:         @responses.last
24:       end
25:     end

Private Instance Methods

increase_position() click to toggle source
    # File lib/webmock/responses_sequence.rb, line 29
29:     def increase_position
30:       if @current_position == (@responses.length - 1)
31:         @current_position = 0
32:         @times_to_repeat -= 1
33:       else
34:         @current_position += 1
35:       end
36:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.