Class: Webmachine::Streaming::EnumerableEncoder Private

Inherits:
Encoder
  • Object
show all
Includes:
Enumerable
Defined in:
lib/webmachine/streaming/enumerable_encoder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Implements a streaming encoder for Enumerable response bodies, such as Arrays.

Instance Attribute Summary

Attributes inherited from Encoder

#body, #charsetter, #encoder, #resource

Instance Method Summary collapse

Methods inherited from Encoder

#initialize

Constructor Details

This class inherits a constructor from Webmachine::Streaming::Encoder

Instance Method Details

#each {|chunk| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Iterates over the body, encoding and yielding individual chunks of the response entity.

Yields:

  • (chunk)

Yield Parameters:

  • chunk (String)

    a chunk of the response, encoded


13
14
15
16
17
# File 'lib/webmachine/streaming/enumerable_encoder.rb', line 13

def each
  body.each do |block|
    yield resource.send(encoder, resource.send(charsetter, block.to_s))
  end
end