Class: Webmachine::Streaming::CallableEncoder Private

Inherits:
Encoder
  • Object
show all
Defined in:
lib/webmachine/streaming/callable_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 callable bodies, such as Proc. (essentially futures)

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

#callString

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.

Encodes the output of the body Proc.


9
10
11
# File 'lib/webmachine/streaming/callable_encoder.rb', line 9

def call
  resource.send(encoder, resource.send(charsetter, body.call.to_s))
end

#to_procProc

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.

Converts this encoder into a Proc.

See Also:


16
17
18
# File 'lib/webmachine/streaming/callable_encoder.rb', line 16

def to_proc
  method(:call).to_proc
end