The code builds a short preview of tasks from an input enumerator and then forms the final string. For some inputs, the final result unexpectedly loses the first element after a harmless check for the presence of data.
QueuePreview.build takes one argument tasks, compatible with Enumerable.tasks is a string of the form "id:state", for example "A:new"."preview=<...>; all=<...>".preview must contain the first two elements after conversion to "ID(STATE)".all must contain all elements in the same converted form."preview=; all=".Run the file:
ruby app.rb
For the data from app.rb, the program should print exactly:
preview=A(NEW),B(DONE); all=A(NEW),B(DONE),C(NEW)
Right now the output differs: after a preliminary check, one of the elements disappears from the full part of the result.
3.3.0Fiber schedulerEnumerator obtained via Array#eachruby app.rbClick a line and write what it prints. Explanation is optional.