Class: HTTPX::Transcoder::Chunker::Encoder

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httpx/transcoder/chunker.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Encoder

Returns a new instance of Encoder.



14
15
16
# File 'lib/httpx/transcoder/chunker.rb', line 14

def initialize(body)
  @raw = body
end

Instance Method Details

#each {|"0#{CRLF}"| ... } ⇒ Object

Yields:



18
19
20
21
22
23
24
25
# File 'lib/httpx/transcoder/chunker.rb', line 18

def each
  return enum_for(__method__) unless block_given?

  @raw.each do |chunk|
    yield "#{chunk.bytesize.to_s(16)}#{CRLF}#{chunk}#{CRLF}"
  end
  yield "0#{CRLF}"
end

#respond_to_missing?(meth, *args) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/httpx/transcoder/chunker.rb', line 27

def respond_to_missing?(meth, *args)
  @raw.respond_to?(meth, *args) || super
end