class Fixturama::Changes::Request::Responses
@private Iterate by a consecutive responses to the request
Public Class Methods
new(*list)
click to toggle source
# File lib/fixturama/changes/request/responses.rb 14 def initialize(*list) 15 list = [{ status: 200 }] if list.empty? 16 @list = list.flatten.reverse.flat_map do |item| 17 response = Response.new(item) 18 [response.to_h] * response.repeat 19 end 20 end
Public Instance Methods
next()
click to toggle source
@return [Fixturama::Changes::Request::Response]
# File lib/fixturama/changes/request/responses.rb 8 def next 9 @list.count > 1 ? @list.pop : @list.first 10 end