class Webmachine::Streaming::FiberEncoder

Implements a streaming encoder for Fibers with the same API as the EnumerableEncoder. This will resume the Fiber until it terminates or returns a falsey value. @api private

Public Instance Methods

each() { |send(encoder, send)| ... } click to toggle source

Iterates over the body by yielding to the fiber. @api private

# File lib/webmachine/streaming/fiber_encoder.rb, line 14
def each
  while body.alive? && chunk = body.resume
    yield resource.send(encoder, resource.send(charsetter, chunk.to_s))
  end
end