Class: FuzzBert::Executor::DataProducer::Ring

Inherits:
Object
  • Object
show all
Defined in:
lib/fuzzbert/executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(objs) ⇒ Ring

Returns a new instance of Ring.

Raises:

  • (ArgumentError)


136
137
138
139
140
141
# File 'lib/fuzzbert/executor.rb', line 136

def initialize(objs)
  @i = 0
  objs = [objs] unless objs.respond_to?(:each)
  @objs = objs.to_a
  raise ArgumentError.new("No test cases found") if @objs.empty?
end

Instance Method Details

#nextObject



143
144
145
146
147
# File 'lib/fuzzbert/executor.rb', line 143

def next
  obj = @objs[@i]
  @i = (@i + 1) % @objs.size
  obj
end