Sha256: 3a200a896ec24beddddaca7da1294e9756e072c31cad892137d1125d4a846cf5

Contents?: true

Size: 904 Bytes

Versions: 8

Compression:

Stored size: 904 Bytes

Contents

module Webmachine
  module Streaming
    # 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
    class Encoder
      attr_accessor :resource, :encoder, :charsetter, :body

      def initialize(resource, encoder, charsetter, body)
        @resource, @encoder, @charsetter, @body = resource, encoder, charsetter, body
      end

      protected
      # @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.
      def is_unencoded?
        encoder.to_s == "encode_identity" &&
          charsetter.to_s == "charset_nop"
      end
    end # class Encoder
  end # module Streaming
end # module Webmachine

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
webmachine-1.6.0 lib/webmachine/streaming/encoder.rb
webmachine-1.5.0 lib/webmachine/streaming/encoder.rb
webmachine-1.4.0 lib/webmachine/streaming/encoder.rb
webmachine-1.3.1 lib/webmachine/streaming/encoder.rb
webmachine-1.3.0 lib/webmachine/streaming/encoder.rb
webmachine-1.2.2 lib/webmachine/streaming/encoder.rb
webmachine-1.2.0 lib/webmachine/streaming/encoder.rb
webmachine-1.1.0 lib/webmachine/streaming/encoder.rb