class JobIteration::EnumeratorBuilder::Wrapper

These wrappers ensure we have a custom type that we can assert on in Iteration. It's useful that the `wrapper` passed to EnumeratorBuilder in `enumerator_builder` is always the type that is returned from `build_enumerator`. This prevents people from implementing custom Enumerators without wrapping them in `enumerator_builder.wrap(custom_enum)`. We don't do this yet for backwards compatibility with raw calls to EnumeratorBuilder. Think of these wrappers the way you should a middleware.

Public Class Methods

wrap(_builder, enum) click to toggle source
# File lib/job-iteration/enumerator_builder.rb, line 21
def self.wrap(_builder, enum)
  new(-> { enum.size }) do |yielder|
    enum.each do |*val|
      yielder.yield(*val)
    end
  end
end