Class: Tep::Proxy::StreamChunk

Inherits:
Object
  • Object
show all
Defined in:
lib/tep/proxy.rb

Overview

One unit handed to on_stream_chunk: a dechunked HTTP chunk or a complete SSE event record. Read the bytes via ‘chunk_text`.

Two spinel constraints shape this:

* The hook param is poly-boxed (it flows through the poly
  on_stream_chunk dispatch), so a bare String would arrive poly
  and block String methods. Wrapping in an object lets the hook
  recover a concrete String via the accessor.
* The accessor is named `chunk_text`, not `text`: a poly value's
  method call resolves by name across ALL classes, and `text`
  collides with Tep::WebSocket::Driver#text (returns int). A
  name with exactly one definition resolves cleanly to a String.
  See [[spinel-widening-dispatch]].

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chunk_text) ⇒ StreamChunk

Returns a new instance of StreamChunk.



747
748
749
# File 'lib/tep/proxy.rb', line 747

def initialize(chunk_text)
  @chunk_text = chunk_text
end

Instance Attribute Details

#chunk_textObject

Returns the value of attribute chunk_text.



745
746
747
# File 'lib/tep/proxy.rb', line 745

def chunk_text
  @chunk_text
end