class Webmachine::Streaming::Encoder

Subclasses of this class implement means for streamed/chunked response bodies to be coerced to the negotiated character set and encoded automatically as they are output to the client. @api private

Attributes

body[RW]
charsetter[RW]
encoder[RW]
resource[RW]

Public Class Methods

new(resource, encoder, charsetter, body) click to toggle source
# File lib/webmachine/streaming/encoder.rb, line 10
def initialize(resource, encoder, charsetter, body)
  @resource, @encoder, @charsetter, @body = resource, encoder, charsetter, body
end

Protected Instance Methods

is_unencoded?() click to toggle source

@return [true, false] whether the stream will be modified by the encoder and/or charsetter. Only returns true if using the built-in “encode_identity” and “charset_nop” methods.

# File lib/webmachine/streaming/encoder.rb, line 19
def is_unencoded?
  encoder.to_s == 'encode_identity' &&
    charsetter.to_s == 'charset_nop'
end